问题
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