开发者

iOS downloading files to the filesystem?

The iPad app that I'm currently working on reads ".epub" files from the Supporting fi开发者_运维知识库les directory within the iOS app. We are currently adding the ability to download arbitrary .epub files from the web. The question is should those files be a) placed into core data directly or b) can they be saved directly to the filesystem, with their location stored on core data?

Can both options be done and if so which one is preferable? Is it as easy to parse an .epub file stored in core data as it is to parse one in the "Supporting Files" directory?


Storing .epub in the app's Documents folder can be a good choice. It comes with a benefit that users can add/delete files via the iTunes File Sharing interface.

The Documents folder is at:

[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];

To download a file, you may take a look in the NSData document:

+ (id)dataWithContentsOfURL:(NSURL *)aURL 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜