xcode 使用带有 PROVISIONING_PROFILE 的 xcodebuild 命令行签署应用程序失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45051712/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:07:36  来源:igfitidea点击:

Signing app with xcodebuild command line with PROVISIONING_PROFILE fails

xcodeprovisioning-profilexcodebuildios-provisioning

提问by programmer_of_the_galaxies

I trying to sign my app command line using Xcode.

我尝试使用 Xcode 签署我的应用程序命令行。

Running xcodebuildcommand-line on MyApp.xcodeprojlike so:

像这样运行xcodebuild命令行:MyApp.xcodeproj

xcodebuild -project "MyApp.xcodeproj" -target "MyApp" -sdk "iphoneos" -configuration *Release* PROVISIONING_PROFILE="xxxx-xxxx-xxxx-xxxx" CODE_SIGN_IDENTITY="iPhone Developer: something.com (SOMEVALUE)"

Gives following error:

给出以下错误:

Check dependencies
Provisioning profile "iOS Team Provisioning Profile: *" doesn't include signing certificate "iPhone Developer: something.com (SOMEVALUE)".
Provisioning profile "iOS Team Provisioning Profile: *" is Xcode managed, but signing settings require a manually managed profile.
Code signing is required for product type 'Application' in SDK 'iOS 10.3'

** BUILD FAILED **

What is wrong ? What is missing in my xcodebuildcommand ?

怎么了 ?我的xcodebuild命令中缺少什么?

How can I include the signing certificate that its asking about ?

我怎样才能包括它询问的签名证书?

What I tried from answer & comments below
As I understand, a dedicated distribution profileshould be used with Release build. That is present in the system. I just need to know how to use it with xcodebuildcommand for manual signing if I can.

我从下面的回答和评论中尝试过的内容
据我了解,distribution profileRelease 版本应该使用专用的。那是存在于系统中的。xcodebuild如果可以,我只需要知道如何将它与命令一起用于手动签名。

Executing security find-identity -p codesigning -v | grep "$CODE_SIGN_IDENTITY"gives a list of 5 signing identities ones of them clearly states as iPhone Distribution: My Company (SOME123ID).

执行security find-identity -p codesigning -v | grep "$CODE_SIGN_IDENTITY"给出了 5 个签名身份的列表,其中一个明确声明为iPhone Distribution: My Company (SOME123ID).

*So, can I use the distribution profile with xcodebuild manual signing? If yes, How can I get the actual ID of a distribution profile to use with xcodebuild command?

*那么,我可以使用带有 xcodebuild 手动签名的分发配置文件吗?如果是,如何获取要与 xcodebuild 命令一起使用的分发配置文件的实际 ID?

回答by Sven Driemecker

Using PROVISIONING_PROFILEis deprecated since Xcode8. Try PROVISIONING_PROFILE_SPECIFIERinstead. PROVISIONING_PROFILE_SPECIFIER="Human Readable Prov Profile Name"

使用PROVISIONING_PROFILE自Xcode8已被弃用。试试吧PROVISIONING_PROFILE_SPECIFIERPROVISIONING_PROFILE_SPECIFIER="Human Readable Prov Profile Name"

It may also be necessary to turn off Xcode's Automatic Signing:

可能还需要关闭 Xcode 的自动签名:

Xcode9: simply append CODE_SIGN_STYLE="Manual"to your xcodebuild command

Xcode9:只需附加CODE_SIGN_STYLE="Manual"到您的 xcodebuild 命令

Xcode8: sed -i '' 's/ProvisioningStyle = Automatic;/ProvisioningStyle = Manual;/' TestApp/TestApp.xcodeproj/project.pbxproj && xcodebuild ...

Xcode8: sed -i '' 's/ProvisioningStyle = Automatic;/ProvisioningStyle = Manual;/' TestApp/TestApp.xcodeproj/project.pbxproj && xcodebuild ...

You can check your Xcode Version on the command-line with xcodebuild -version

您可以在命令行上检查您的 Xcode 版本 xcodebuild -version