我一直在尝试使用 xcodebuild 命令从命令行(在 Mac 机器上)构建 iOS 应用程序。
这是我用来导出存档的命令:
xcodebuild -project "Path/BuildOutput/XCode/Unity-iPhone.xcodeproj" -scheme "Unity-iPhone" archive -archivePath "Path/BuildOutput/XCode/Archive.xcarchive" -destination "generic/platform=iOS" -configuration Release PROVISIONING_PROFILE="xxxxxxxx-yyyyyyyy"
配置文件“xxxxxxxx-yyyyyyyy”在我的 Apple 开发者网站上创建为“Ad Hoc”类型配置文件,它使用类型为“Distribution”的证书,在创建时显示为“Apple Distribution”
我收到以下错误:
error: No signing certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID "XXXXXXXXXX" with a private key was found. (in target 'Unity-iPhone' from project 'Unity-iPhone')
当我使用类型为“开发”的配置文件并且相应的证书也是“iOS 开发”类型时,不会发生错误。看起来,尽管我指定了“Ad Hoc”类型的配置文件,xcodebuild 仍然尝试查找相应的“iOS Development”类型证书,而实际证书类型不匹配。
当我进入 XCode 首选项和“管理证书”时,“Apple Distribution”证书正确显示
我现在陷入困境,不知道该怎么办。任何帮助将不胜感激。
最佳答案
我在 Xcode 13 中遇到了同样的问题。Xcode 似乎混淆了配置文件/证书。
在 IDE 中,我注意到可以通过重新选择每个配置的配置文件(在我的例子中为 dev/QA/prod)来解决这个问题。我必须为每个配置选择错误的配置文件,然后选择正确的配置文件,然后我就会看到错误消失。 xcodebuild 工作了。
为了在不干扰 Xcode 的情况下进行修复,我向 xcodebuild 添加了 CODE_SIGN_IDENTITY="iPhone Distribution"选项
就您而言:
xcodebuild -project "Path/BuildOutput/XCode/Unity-iPhone.xcodeproj" -scheme "Unity-iPhone" archive -archivePath "Path/BuildOutput/XCode/Archive.xcarchive" -destination "generic/platform=iOS" -configuration Release PROVISIONING_PROFILE="xxxxxxxx-yyyyyyyy" CODE_SIGN_IDENTITY="iPhone Distribution"
关于ios - 即使我指定了 "Development Certificate"配置文件,xcodebuild 存档仍然尝试使用 "AdHoc Distribution",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71404609/