what's the difference between NSCachesDirectory and NSDownloadsDirectory in iOS?

谁说胖子不能爱 提交于 2020-01-23 10:51:09

问题


I want to save downloaded magazines to one directory in my iOS app. It seems NSCachesDirectory and NSDownloadsDirectory are suitable. I don't know the difference between them and which one is suitable for downloading magazines. Any suggestions are appreciated.


回答1:


NSCachesDirectory can be deleted in cases of low memory

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..

Please look at the apple's File System Programming Guide or File System Basics




回答2:


i would prefer NSCachesDirectory or temp directory to save files, because for NSDownloadsDirectory or document directory, you have to use don't back up or iCloud for greater than iOS 5. because iOS 5.0 does not allow to save any data in document directory , it is a major reason to rejection of app store.



来源:https://stackoverflow.com/questions/15083484/whats-the-difference-between-nscachesdirectory-and-nsdownloadsdirectory-in-ios

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!