谁能推荐在 Xcode Build Phases 中应该使用哪些文件夹来进行 iOS 部署以复制一 (1) 个用户数据文件和一 (1) 个系统数据文件?部署目标是 iOS v.5.1。我在 Apple Developer Library 中读到,用户数据文件应位于 Application_Home/Documents 中,系统数据文件应位于 Application_Home/Library 中?对我来说似乎很奇怪,这些不在“目的地”下拉菜单中,或者它们被称为资源之类的其他东西?我不希望在 AppStore 更新期间覆盖用户数据文件。谢谢...
目的地:绝对路径
子路径:Application_Home/Documents
仅在安装时复制
目的地:绝对路径
子路径:Application_Home/Library
仅在安装时复制
最佳答案
据我了解,您想确认在应用程序更新后,您不希望文件被覆盖。为此请参阅 this
Files Saved During Application Updates When a user downloads an application update, iTunes installs the update in a new application directory. It then moves the user’s data files from the old installation over to the new application directory before deleting the old installation. Files in the following directories are guaranteed to be preserved during the update process:
<Application_Home>/Documents <Application_Home>/Library
Although files in other user directories may also be moved over, you should not rely on them being present after an update.
对于文档目录路径
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *docsPath = [paths objectAtIndex:0];
对于库目录路径
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
NSString *docsPath = [paths objectAtIndex:0];
更多路径请引用 Apple Application Programming Guide
关于ios - 在 Xcode 构建阶段推荐文件夹?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12324001/