2

我想通过组合其他两种文件类型(如 .mp3 和 .pdf)来创建具有个人扩展名的文件类型。

稍后我需要重新打开我制作的自定义文件,并能够在我的应用程序中使用包含的文件。

我如何在 iOS 上做到这一点?

4

1 回答 1

2

One option is to append the data of the two files together. Include a few bytes of data at the start that tell you the size of each and maybe their original filenames. Then when you want to recreate the two files from the one custom one, you read your header to get the sizes and names, then use that info to recreate the original files.

Another option would be to zip the two files together. Just give the zip file your own custom extension.

Another option would be to use an NSFileWrapper. Include the two regular files in the wrapper.

于 2013-03-29T22:19:37.740 回答