ios - 在 Xcode 构建阶段推荐文件夹?

标签 ios build

谁能推荐在 Xcode Build Phases 中应该使用哪些文件夹来进行 iOS 部署以复制一 (1) 个用户数据文件和一 (1) 个系统数据文件?部署目标是 iOS v.5.1。我在 Apple Developer Library 中读到,用户数据文件应位于 Application_Home/Documents 中,系统数据文件应位于 Application_Home/Library 中?对我来说似乎很奇怪,这些不在“目的地”下拉菜单中,或者它们被称为资源之类的其他东西?我不希望在 AppStore 更新期间覆盖用户数据文件。谢谢...

  • 复制文件(1 项)
    目的地:绝对路径
    子路径:Application_Home/Documents
    仅在安装时复制
  • 复制文件(1 项)
    目的地:绝对路径
    子路径: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/

    相关文章:

    ios - 如何修复 "App Store Connect Operation ERROR ITMS-90771"

    iOS 应用 View 选择

    android - 在 Windows 上使用 Ant for Android 将新构建文件输出到新版本号文件夹

    java - 在应用程序中显示构建时间戳

    ios - 从项目中删除 LaunchScreen.xib

    ios - UIButton 和 @3x 图像(使用图像资源)

    build - 如何使用带有 js_of_ocaml 的模块?

    linux - 为 ARM 架构构建 libsndfile 库

    ios - iPad 应用程序的自定义数字键盘

    xamarin - 减少 Xamarin.Android 项目的构建时间