IOS File System

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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值