xcodebuild 的 CODE_SIGN_IDENTITY 参数 (Xcode 4)

发布于 2025-01-04 22:37:26 字数 488 浏览 5 评论 0原文

我正在使用 Xcode 3 附带的 xcodebuild 实用程序来自动执行 Hudson 下的构建。该命令如下所示:

xcodebuild -project Project.xcodeproj -target Target -configuration Release -sdk iphoneos CODE_SIGN_IDENTITY[sdk=iphoneos*]="iPhone Distribution:XXXXXX"

我尝试对 Xcode 4 使用相同的命令,但似乎 xcodebuild 只是忽略 CODE_SIGN_IDENTITY 参数并使用配置文件进行签名,该配置文件是在 Xcode 中为目标选择。

这对我来说非常重要,因为我必须使用 3-4 个不同的配置文件来签署构建。它在 Xcode 3 上工作正常,但在 Xcode 4 上不起作用。

知道如何解决这个问题吗?

I'm using xcodebuild utility shipped with Xcode 3 to automate my builds under Hudson. The command looks like it follows:

xcodebuild -project Project.xcodeproj -target Target -configuration Release -sdk iphoneos CODE_SIGN_IDENTITY[sdk=iphoneos*]="iPhone Distribution:XXXXXX"

I'm trying to use the same command for Xcode 4 but it seems that xcodebuild just ignores CODE_SIGN_IDENTITY parameter and signs with the provisioning profile which is selected for the target in Xcode.

It's a quite crucial for me since I have to sign build with 3-4 different profiles. It works OK with Xcode 3 but doesn't work with Xcode 4.

Any idea how to solve this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

剑心龙吟 2025-01-11 22:37:26

较新的 xcodebuild 现在允许指定设置。
取自 developer.apple.com< /a>:

xcodebuild [-project projectname] [-target targetname ...]
           [-configuration configurationname] [-sdk [sdkfullpath | sdkname]]
           [buildaction ...] [setting=value ...] [-userdefault=value ...]

我还找到了这个资源来解释 可用设置

CODE_SIGN_IDENTITY (Code Signing Identity)
    Description: Identifier. Specifies the name of a code signing identity.
    Example value: iPhone Developer

但是,索引中缺少 PROVISIONING_PROFILE可用命令。

我最终使用的命令指定了“CODE_SIGN_IDENTITY”& “PROVISIONING_PROFILE”设置。

xcodebuild -sdk <iphoneos> -target <target_name> -configuration <Debug> CODE_SIGN_IDENTITY="iPhone Developer: Mister Smith" PROVISIONING_PROFILE="XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX"

A newer xcodebuild now allows settings to be specified.
Taken from developer.apple.com:

xcodebuild [-project projectname] [-target targetname ...]
           [-configuration configurationname] [-sdk [sdkfullpath | sdkname]]
           [buildaction ...] [setting=value ...] [-userdefault=value ...]

I also found this resource for explaining the available settings

CODE_SIGN_IDENTITY (Code Signing Identity)
    Description: Identifier. Specifies the name of a code signing identity.
    Example value: iPhone Developer

However, PROVISIONING_PROFILE is missing from the index of available commands.

The command I finally used specified "CODE_SIGN_IDENTITY" & "PROVISIONING_PROFILE" settings.

xcodebuild -sdk <iphoneos> -target <target_name> -configuration <Debug> CODE_SIGN_IDENTITY="iPhone Developer: Mister Smith" PROVISIONING_PROFILE="XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX"
半世晨晓 2025-01-11 22:37:26

我遇到了以下问题:

我们的开发人员使用“iPhone Development”签名身份,但我需要为我们的自动化集成系统使用“iPhone Distribution”签名身份。

添加了这一行:以交换代码签名身份(请参阅 -f 标志)。

codesign -f --sign "iPhone Distribution: XXXXXXX" ${PATH_TO_APP}

因此,我在 xcodebuildxcrun 命令之间

I had following problem:

Our developers used the 'iPhone Development' signing identity, but I needed to use the 'iPhone Distribution' signing identity for our automated integration system.

So I added the line:

codesign -f --sign "iPhone Distribution: XXXXXXX" ${PATH_TO_APP}

between the xcodebuild and the xcrun commands to swap the code signing identities (see the -f flag).

記柔刀 2025-01-11 22:37:26

据我所知,Xcode 4 中的签名是通过 xcrun 工具完成的:

/usr/bin/xcrun -sdk "iphoneos" PackageApplication -v "myapp.app" -o "myapp.ipa" --sign "iPhone Developer: XXXXX" --embed "XXXXX.mobileprovisioning"

使用起来有点不舒服,因为您必须同时指定您的身份和 mobileprovisioning 文件。如果您使用 ~/Library/MobileDevice/Provisioning Profiles/ 目录中的最后一个,则尤其不舒服,因为每次从 Provisioning Portal 自动更新配置文件时,其名称都会更改。

As far as I know in Xcode 4 signing is done with xcrun tool:

/usr/bin/xcrun -sdk "iphoneos" PackageApplication -v "myapp.app" -o "myapp.ipa" --sign "iPhone Developer: XXXXX" --embed "XXXXX.mobileprovisioning"

It is a bit uncomfortable to use because you must specify both your identity and mobileprovisioning file. Especially uncomfortable if you use last one from ~/Library/MobileDevice/Provisioning Profiles/ directory because its name is changed every time provisioning profiles are updated automatically from Provisioning Portal.

够运 2025-01-11 22:37:26

只需将 CODE_SIGN_IDENTITY="iPhone Distribution:XXXXXX" 与 Xcode 4 一起使用(不带 [sdk=iphoneos*])

xcodebuild -project Project.xcodeproj -target Target -configuration Release -sdk iphoneos CODE_SIGN_IDENTITY="iPhone Distribution:XXXXXX"

Just use CODE_SIGN_IDENTITY="iPhone Distribution:XXXXXX" with Xcode 4 (without [sdk=iphoneos*])

xcodebuild -project Project.xcodeproj -target Target -configuration Release -sdk iphoneos CODE_SIGN_IDENTITY="iPhone Distribution:XXXXXX"
(り薆情海 2025-01-11 22:37:26

我找到了使用詹金斯构建的一个很好的解决方法。

首先,在设置作业之前,下载一个名为:

Parameterized Trigger Plugin

的 jenkins 插件https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin

完成此操作后,创建作业,并在创建作业时选择

“此构建是参数化'复选框

创建字符串参数。我将我的称为 CODE_SIGN_IDENTITY。

因此,字符串参数中的名称字段应为:


名称:CODE_SIGN_IDENTITY

默认值:iPhone 开发人员:XXX XXXXXX

描述:无论您想放在那里


然后在您的 Xcode 插件中,找到“自定义 xcodebuild 参数”字段。

在“自定义 xcodebuild 参数”字段中,输入以下值:

CODE_SIGN_IDENTITY=${CODE_SIGN_IDENTITY}

完成作业设置,您应该已准备就绪!

这将绕过空白问题。该插件是一个救星,因为它工作得非常好,您可以使用其他参数自定义您的构建。

I found a great workaround for building with jenkins.

Firstly, before setting up a job, download a jenkins plugin called:

Parameterized Trigger Plugin

https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin

Once you do that, create your job and while creating the job, select the

'This build is parameterized' checkbox

Create a String Parameter. I call mine CODE_SIGN_IDENTITY.

So the name field in the String Parameter should be:


Name: CODE_SIGN_IDENTITY

Default Value: iPhone Developer: XXX XXXXX

Description: Whatever you want to put there


Then in your Xcode Plugin, find the 'Custom xcodebuild arguments' field.

In the Custom xcodebuild arguments field, place the following value:

CODE_SIGN_IDENTITY=${CODE_SIGN_IDENTITY}

Finish setting up your job and you should be all set!

This will bypass the white space issue. The plugin is a life saver as it works wonderfully and you can customize your build with other parameters.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文