【发布时间】:2012-08-05 05:47:40
【问题描述】:
我认为有很多关于 ios 存储指南的问题。我找到了one here。但我想对此进行更多澄清:
我在 NSDocumentDirectory 中存储的文件很少.. 例如我的数据库文件、Plist 文件以及一些临时的音频和视频文件..
在 ios http://developer.apple.com/library/ios/#qa/qa1719/_index.html 时显示问题
在 ios 5.1 有不同的方法和 iso 5.0.1 有不同.. 和 ios 5.0 不允许文件以防止备份
我的问题是:
- 我是否必须通过检查 ios 5.1 和 5.0.1 的 ios 版本来实现这两种方法?
- 我是否应该为我的数据库文件和 plist 文件使用 Caches 目录而不是 NSDocument 目录,因为在 ios 5.0 中没有阻止文件备份到 icloud 上的选项?
- iOS 会在必要时从 Caches 目录中删除您的文件,所以如果我将数据库文件存储在 Caches 目录中,我该如何存储它。我不想丢失数据。
如链接中所述:
It is not possible to exclude data from backups on iOS 5.0. If your app must support iOS 5.0, then you will need to store your app data in Caches to avoid that data being backed up. iOS will delete your files from the Caches directory when necessary, so your app will need to degrade gracefully if it's data files are deleted.
我不希望我的数据库和 plist 文件在任何情况下都被删除。
任何建议。
【问题讨论】:
标签: iphone ios5 nsdocumentdirectory