简体   繁体   中英

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." (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. How can I do this?

As of Xcode 10, here is how to turn off code signing for a macOS app:

  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.

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:

    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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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