使用xcodebuild构建iOS应用程序而不使用codeign

时间:2022-05-17 09:46:28

We're building an app for another company. They hold the signing key and would rather not share it with us.

我们正在为另一家公司构建应用程序。他们持有签名密钥,宁愿不与我们分享。

It should be possible to separate build and sign, but how do I specify it on xcodebuild's command line?

应该可以分离构建和签名,但是如何在xcodebuild的命令行中指定它?

EDIT for those coming here from search. The accepted answer is correct - it does what the question asks for. However, the big picture is separating build and codesign (allowing a developer that doesn't have the distribution key to build the app). Newer versions of Xcode provide the tools for that. This is not strictly an answer to this question, so I posted it as a gist: https://gist.github.com/noamtm/5c3aaa0b615477162ccd.

编辑来自搜索的人。接受的答案是正确的 - 它完成了问题所要求的。然而,重要的是分离构建和协同设计(允许没有分发密钥的开发人员构建应用程序)。较新版本的Xcode为此提供了工具。这不是这个问题的严格答案,所以我将其作为一个要点发布:https://gist.github.com/noamtm/5c3aaa0b615477162ccd。

4 个解决方案

#1


103  

In order to skip the code signing you can perform a manual build from the console like this:

为了跳过代码签名,您可以从控制台执行手动构建,如下所示:

xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO

Use additionally the -configuration, -target and -sdk parameters in order to define your build settings.

另外使用-configuration,-target和-sdk参数来定义构建设置。

Refer to this * answer in order to get a detailed description on how to disable code-signing inside Xcode.

请参阅此*答案,以获得有关如何在Xcode中禁用代码签名的详细说明。

#2


8  

Unfortunately it can be hard to build your app in release mode without code signing. You will get errors from the build system such as this:

不幸的是,如果没有代码签名,很难在发布模式下构建您的应用。您将从构建系统中获得错误,例如:

CodeSign error: code signing is required for product type 'Application' in SDK
                'iOS 5.1'

In this case, you should configure your target to use your developer/team wildcard (*) signing identity in Release mode. The app will be signed with that when you build it, and you can ship it to your customer so they can resign it. This is what most of our outsourced developers do.

在这种情况下,您应该将目标配置为在发布模式下使用开发人员/团队通配符(*)签名身份。该应用程序将在您构建时与其签名,您可以将其发送给您的客户,以便他们可以将其重新签名。这就是我们大多数外包开发人员所做的事情。

You may then be able to remove the code signing information by deleting the various files in the app like _CodeSignature and using the codesign tool to remove information from the application binary. But I'm not sure how easy that is. It's not really essential though. There isn't any sensitive information in the provisioning profile or signing information.

然后,您可以通过删除应用程序中的各种文件(如_CodeSignature)并使用codesign工具从应用程序二进制文件中删除信息来删除代码签名信息。但我不确定这有多容易。但这并不是必不可少的。配置文件或签名信息中没有任何敏感信息。

#3


6  

To completely prevent code signing with Xcode 7, I used all of the following options:

为了完全阻止使用Xcode 7进行代码签名,我使用了以下所有选项:

CODE_SIGN_IDENTITY=""
CODE_SIGNING_REQUIRED="NO"
CODE_SIGN_ENTITLEMENTS=""
CODE_SIGNING_ALLOWED="NO"

The final option, CODE_SIGNING_ALLOWED="NO" seemed to do the trick.

最后一个选项,CODE_SIGNING_ALLOWED =“NO”似乎可以解决问题。

#4


3  

In the Project Navigator, select your project and open the "Build Settings" section of your project (and not any particular target).

在Project Navigator中,选择项目并打开项目的“Build Settings”部分(而不是任何特定目标)。

Under "Code Signing", find "Code Signing Identity" and for both Debug and Release modes set "Any iOS SDK" to "Don't Code Sign".

在“代码签名”下,找到“代码签名标识”,对于调试和发布模式,将“任何iOS SDK”设置为“不代码签名”。

#1


103  

In order to skip the code signing you can perform a manual build from the console like this:

为了跳过代码签名,您可以从控制台执行手动构建,如下所示:

xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO

Use additionally the -configuration, -target and -sdk parameters in order to define your build settings.

另外使用-configuration,-target和-sdk参数来定义构建设置。

Refer to this * answer in order to get a detailed description on how to disable code-signing inside Xcode.

请参阅此*答案,以获得有关如何在Xcode中禁用代码签名的详细说明。

#2


8  

Unfortunately it can be hard to build your app in release mode without code signing. You will get errors from the build system such as this:

不幸的是,如果没有代码签名,很难在发布模式下构建您的应用。您将从构建系统中获得错误,例如:

CodeSign error: code signing is required for product type 'Application' in SDK
                'iOS 5.1'

In this case, you should configure your target to use your developer/team wildcard (*) signing identity in Release mode. The app will be signed with that when you build it, and you can ship it to your customer so they can resign it. This is what most of our outsourced developers do.

在这种情况下,您应该将目标配置为在发布模式下使用开发人员/团队通配符(*)签名身份。该应用程序将在您构建时与其签名,您可以将其发送给您的客户,以便他们可以将其重新签名。这就是我们大多数外包开发人员所做的事情。

You may then be able to remove the code signing information by deleting the various files in the app like _CodeSignature and using the codesign tool to remove information from the application binary. But I'm not sure how easy that is. It's not really essential though. There isn't any sensitive information in the provisioning profile or signing information.

然后,您可以通过删除应用程序中的各种文件(如_CodeSignature)并使用codesign工具从应用程序二进制文件中删除信息来删除代码签名信息。但我不确定这有多容易。但这并不是必不可少的。配置文件或签名信息中没有任何敏感信息。

#3


6  

To completely prevent code signing with Xcode 7, I used all of the following options:

为了完全阻止使用Xcode 7进行代码签名,我使用了以下所有选项:

CODE_SIGN_IDENTITY=""
CODE_SIGNING_REQUIRED="NO"
CODE_SIGN_ENTITLEMENTS=""
CODE_SIGNING_ALLOWED="NO"

The final option, CODE_SIGNING_ALLOWED="NO" seemed to do the trick.

最后一个选项,CODE_SIGNING_ALLOWED =“NO”似乎可以解决问题。

#4


3  

In the Project Navigator, select your project and open the "Build Settings" section of your project (and not any particular target).

在Project Navigator中,选择项目并打开项目的“Build Settings”部分(而不是任何特定目标)。

Under "Code Signing", find "Code Signing Identity" and for both Debug and Release modes set "Any iOS SDK" to "Don't Code Sign".

在“代码签名”下,找到“代码签名标识”,对于调试和发布模式,将“任何iOS SDK”设置为“不代码签名”。