现在的位置: 首页 > 综合 > 正文

IOS File System

2014年01月30日 ⁄ 综合 ⁄ 共 2221字 ⁄ 字号 评论关闭

IOS File System

Figure 1-1  Each iOS app operates within its own sandbox

  • <Application_Home>/Application.app //bundle data,
  • <Application_Home>/Documents // critical user document and app data files.
  • <Application_Home>/Library
  • <Application_Home>/tmp

iCloud and iTunes do not back up contents of the the following directories:

  • <Application_Home>/Application.app (bundle)
  • <Application_Home>/Library/Caches
  • <Application_Home>/tmp

IOS数据backup的准则:

  • Critical data should be stored in the <Application_Home>/Documents directory. Critical data is any data that cannot be recreated by your app, such as user documents and other user-generated content.
  • Support files include files your application downloads or generates and that your application can recreate as needed. The location for storing your application’s support files depends on the current iOS version.
    • In iOS 5.1 and later, store support files in the <Application_Home>/Library/Application Support directory and add the NSURLIsExcludedFromBackupKey attribute
      to the corresponding NSURL object using thesetResourceValue:forKey:error: method.
      (If you are using Core Foundation, add thekCFURLIsExcludedFromBackupKey key
      to your CFURLRef object using theCFURLSetResourcePropertyForKey function.)
      Applying this attribute prevents the files from being backed up to iTunes or iCloud. If you have a large number of support files, you may store them in a custom subdirectory and apply the extended attribute to just the directory.
    • In iOS 5.0 and earlier, store support files in the <Application_Home>/Library/Caches directory to prevent them from being backed up. If you are targeting iOS 5.0.1, see How
      do I prevent files from being backed up to iCloud and iTunes?
       for information about how to exclude files from backups.
  • Cached data should be stored in the <Application_Home>/Library/Caches directory. Examples of files you should put in the Caches directory include (but are not limited to) database cache files and
    downloadable content, such as that used by magazine, newspaper, and map apps. Your app should be able to gracefully handle situations where cached data is deleted by the system to free up disk space.
  • Temporary data should be stored in the <Application_Home>/tmp directory. Temporary data comprises any data that you do not need to persist for an extended period of time. Remember to delete those files when you are done
    with them so that they do not continue to consume space on the user's device.

在下面的目录中的数据在version update后不会改变:

  • <Application_Home>/Documents
  • <Application_Home>/Library

抱歉!评论已关闭.