Where we have to store download data in iPhone application?

陌路散爱 提交于 2019-11-28 10:15:36

According to the iOS Data Storage Guidelines you should probably be storing your purchased data inside the Application_Home/Library/Caches directory. The downloaded data does not belong in the Documents folder.

Apple provides a list of the various directories and what you should put in those in the File System Programming Guide. The most important includes:

  • Application_Home/Documents/ Use this directory to store user documents and application data files.
  • Application_Home/Library/ This directory is the top-level directory for files that are not user data files.
  • Application_Home/tmp/ Use this directory to write temporary files that do not need to persist between launches of your application.

Generally this means that anything that is not intended to be seen by the user should go into a directory inside the Library directory. Typically you would use one of these, but there is a larger list with more specialized uses in the File System Programming Guide:

  • Application Support: Use this directory to store all application data files except those associated with the user’s documents.
  • Caches: Use this directory to write any application-specific support files that your application can recreate easily

The Application Support folder is backed up but the Caches is not.

The answer is spelled out in the iOS Data Storage Guidelines, but it has downsides. It says clearly that the Documents directory is reserved for user-created content, and that the Caches directory is for content that can be downloaded again or regenerated. It's possible also that the size of the data factors into their approval. That answers your question, but it ignores the fact that it can be a burden for the user to re-download your data; argue your case and submit your feedback, but be prepared to change your download destination directory to the Caches directory.

iOS Data Storage Guidelines: http://developer.apple.com/icloud/documentation/data-storage/

You also asked for info on iCloud functionality... data storage and iCloud APIs are two different things. Read here: http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/iCloud/iCloud.html#//apple_ref/doc/uid/TP40007072-CH5-SW1

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