简体   繁体   English

如何在 Xcode 中跳过开发版本的代码签名?

[英]How can I skip code signing for development builds in Xcode?

Whenever I build my Xcode project, after compiling all my code, it takes forever to finish "signing product."每当我构建我的 Xcode 项目时,在编译我的所有代码之后,完成“签署产品”需要很长时间 (I believe it's because the project includes about 200 MB of resources that need signing.) I would like to skip the code signing during development, so the build can finish faster. (我相信这是因为该项目包含大约 200 MB 的需要签名的资源。)我想在开发过程中跳过代码签名,这样构建可以更快地完成。 How can I do this?我怎样才能做到这一点?

As of Xcode 10, here is how to turn off code signing for a macOS app:从 Xcode 10 开始,以下是关闭 macOS 应用程序代码签名的方法:

  1. Select your project in the project navigator.在项目导航器中选择您的项目。
  2. Select your app in the list of targets.在目标列表中选择您的应用。
  3. Click “Build Settings”.单击“构建设置”。
  4. Click “All”.单击“全部”。
  5. Click “Levels”.单击“级别”。
  6. Type “identity” into the search field.在搜索字段中输入“身份”。

前六个步骤

  1. Click on the Code Signing Identity row, under the column for your app target (labeled “test” in my example).单击应用程序目标列下的代码签名标识行(在我的示例中标记为“测试”)。 That cell of the table might appear empty.表格的那个单元格可能显示为空。

在哪里点击第 7 步

  1. In the pop-up menu that appears, choose “Other…”.在出现的弹出菜单中,选择“其他...”。

弹出菜单

  1. In the popover text box that appears, delete all text so the box is empty.在出现的弹出文本框中,删除所有文本,使该框为空。

空弹出框

  1. Press return to dismiss the popover.按回车键关闭弹出框。

With this setting, Xcode will not sign your app target.使用此设置,Xcode 将不会签署您的应用程序目标。

To turn the code signing off, go to your project and target "Build Settings", search for "Code Signing Identity" change its value to "Don't Code Sign" in both of them.要关闭代码签名,请转到您的项目并以“构建设置”为目标,搜索“代码签名标识”将其值更改为“不要代码签名”。

To make this effective you need to change this value in the Project and all of the Targets separately.要使其有效,您需要分别在项目和所有目标中更改此值。

If someone uses CMake (for multi-platform projects) to disable code signing for specific target I used this:如果有人使用CMake (用于多平台项目)来禁用特定目标的代码签名,我使用了这个:

    set_target_properties(MyAppTarget PROPERTIES
        XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY ""
        OUTPUT_NAME "My nice application name"
        MACOSX_BUNDLE TRUE
        MACOSX_BUNDLE_BUNDLE_NAME "My nice application name"
        MACOSX_BUNDLE_INFO_PLIST path/to/Info.plist
        MACOSX_BUNDLE_BUNDLE_VERSION ${MY_APP_VERSION}
        MACOSX_BUNDLE_LONG_VERSION_STRING "My nice application name v${MY_APP_VERSION}"
        MACOSX_BUNDLE_SHORT_VERSION_STRING "${MY_APP_VERSION}"
        MACOSX_BUNDLE_GUI_IDENTIFIER "com.my.app"
        MACOSX_BUNDLE_COPYRIGHT "(C) 2019 My Company"
        MACOSX_RPATH TRUE
        MACOSX_FRAMEWORK_IDENTIFIER com.myapp.bundle.id
        XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@loader_path/Libraries"
        RESOURCE "${RESOURCE_FILES}"
        XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME TRUE
        XCODE_ATTRIBUTE_EXECUTABLE_NAME "exec_name"
    )

您可以尝试将您的资源移动到一个单独的捆绑目标,然后将该目标的 .bundle 产品添加到您的应用程序的“复制捆绑资源”构建阶段——理想情况下,应用程序构建应该能够使用捆绑包的签名(这将只需要包的内容更改时重新生成),而不必单独重新签名资源。

FWIW for iOS builds that you build into your simulator, you don't need code-signing. FWIW for iOS 构建您构建到您的模拟器中,您不需要代码签名。 Hence no need to skip it.因此无需跳过它。

You only need code-signing/Provisioning Profile on physical devices.您只需要在物理设备上进行代码签名/配置文件。 I'm not aware of how you can skip them.我不知道如何跳过它们。

This other answer that I have not tried suggest that you can build without code-signing if you jailbreak but I'm not sure if it's answer is valid now我还没有尝试过的另一个答案表明,如果您越狱,您可以在没有代码签名的情况下进行构建,但我不确定它的答案现在是否有效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM