[英]what's the difference between NSCachesDirectory and NSDownloadsDirectory in iOS?
I want to save downloaded magazines to one directory in my iOS app. 我想将下载的杂志保存到我的iOS应用程序中的一个目录中。 It seems
NSCachesDirectory
and NSDownloadsDirectory
are suitable. 似乎
NSCachesDirectory
和NSDownloadsDirectory
是合适的。 I don't know the difference between them and which one is suitable for downloading magazines. 我不知道它们之间的区别,哪一个适合下载杂志。 Any suggestions are appreciated.
任何建议表示赞赏。
NSCachesDirectory can be deleted in cases of low memory 在内存不足的情况下可以删除NSCachesDirectory
If you don't want your files to be deleted you have to store them in the Documents directory, but add "do not backup" if you don't want your files to be backed by iTunes, iCloud etc.. 如果您不希望删除文件,则必须将它们存储在Documents目录中,但如果您不希望iTunes,iCloud等支持您的文件,请添加“不备份”。
Please look at the apple's File System Programming Guide or File System Basics 请查看Apple的文件系统编程指南或文件系统基础知识
我更喜欢NSCachesDirectory或临时目录来保存文件,因为对于NSDownloadsDirectory或文档目录,你必须使用不备份或iCloud超过iOS 5.因为iOS 5.0不允许在文档目录中保存任何数据,它是拒绝app商店的主要原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.