xcode -allowProvisioningUpdates 不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46295291/
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:15:07  来源:igfitidea点击:

-allowProvisioningUpdates doesn't work

iosxcodecontinuous-integrationxcode9

提问by Trantec

We are using Jenkins for Continiuous Integration. Everything we need to do in order to compile our app is done via commandline (bash script), because we have several machines where the build has be done without any human access to the devices.

我们正在使用 Jenkins 进行持续集成。为了编译我们的应用程序,我们需要做的一切都是通过命令行(bash 脚本)完成的,因为我们有几台机器,在这些机器上已经完成了构建,而无需任何人工访问设备。

As you can imagine I was very happy to see the new xcodebuild feature flag -allowProvisioningUpdates in XCode9.

可以想象,我很高兴在 XCode9 中看到新的 xcodebuild 功能标志 -allowProvisioningUpdates。

I understand, that I need to add the credentials of our Apple ID into the XCode settings.

我了解,我需要将 Apple ID 的凭据添加到 XCode 设置中。

The credentials are adde to the XCode account tab in Preferences, but when I try to compile using "xcodebuild ... -allowProvisioningUpdates" the following error message appears:

凭据已添加到首选项中的 XCode 帐户选项卡中,但是当我尝试使用“xcodebuild ... -allowProvisioningUpdates”进行编译时,会出现以下错误消息:

 2017-09-19 09:47:59.692 xcodebuild[74979:3824315]  DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/DVTFrameworks/DVTFrameworks-13231/DVTFoundation/Portal/DVTDeveloperAccountCredentialsManager.m:38  
Details:  Unable to find default keychain.  
Object:   <DVTDeveloperAccountCredentialsManager>  
Method:   +defaultAccountCredentialsManager  
Thread:   <NSThread: 0x7fe17860aa40>{number = 4, name = (null)}  
Please file a bug at http:/  
2017-09-19 09:47:59.792 xcodebuild[74979:3824308] [MT] IDEDistribution: Step failed: <IDEDistributionSigningAssetsStep: 0x7fe17d45cf20>: Error Domain=IDEDistributionSigningAssetStepErrorDomain Code=0 "Locating signing assets failed." UserInfo={NSLocalizedDescription=Locating signing assets failed., IDEDistributionSigningAssetStepUnderlyingErrors=(  
    "Error Domain=DVTServicesSessionErrorDomain Code=0 \"Unable to log in with account '[email protected]'.\" UserInfo={NSLocalizedFailureReason=Unable to log in with account '[email protected]'., NSLocalizedRecoverySuggestion=The login details for account '[email protected]' were rejected., DVTDeveloperAccountErrorAccount=<DVTAppleIDBasedDeveloperAccount 0x7fe179b016c0: username: [email protected]>, NSUnderlyingError=0x7fe179e8ee60 {Error Domain=DVTDeveloperAccountErrorDomain Code=4 \"[email protected] could not sign in.\" UserInfo={NSLocalizedRecoverySuggestion=Cannot sign in to this account. Try signing into it again in the Accounts preference pane., [email protected] could not sign in., DVTDeveloperAccountErrorAccount=<DVTAppleIDBasedDeveloperAccount 0x7fe179b016c0: username: [email protected]>}}}",  
    "Error Domain=IDEProfileLocatorErrorDomain Code=1 \"No profiles for 'com.yyy.CITestProject' were found\" UserInfo={NSLocalizedDescription=No profiles for 'com.yyy.CITestProject' were found, NSLocalizedRecoverySuggestion=Xcode couldn't find any iOS App Store provisioning profiles matching 'com.yyy.CITestProject'.}"  
)}  
error: exportArchive: The operation couldn't be completed. Unable to log in with account '[email protected]'.

Does someone know how to fix this problem?

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

update:We use this plugin to start ssh sessions to our Jenkins slaves in order to do the buildjob: https://wiki.jenkins.io/display/JENKINS/SSH+Slaves+plugin

更新:我们使用这个插件来启动 ssh 会话到我们的 Jenkins slaves 以完成 buildjob:https://wiki.jenkins.io/display/JENKINS/SSH+Slaves+plugin

回答by Gary Hooper

I have the same problem. I reported the bug to Apple, to no avail. To move forward with Xcode 9, I switched to manual signing for Jenkins only. (Developers still use automatic signing.)

我也有同样的问题。我向Apple报告了该错误,但无济于事。为了继续使用 Xcode 9,我切换到仅对 Jenkins 进行手动签名。(开发人员仍然使用自动签名。)

/usr/bin/xcodebuild -exportArchive \
    DEVELOPMENT_TEAM=*your-dev-team-id* \
    CODE_SIGN_STYLE=Manual \
    CODE_SIGN_IDENTITY="iPhone Distribution: *your cert*" \
    PROVISION_PROFILE="*your*.mobileprovision" \
    *rest of your parameters*

回答by Ed of the Mountain

This -allowProvisioningUpdatesworked for me in Xcode 9 final release.

这个-allowProvisioningUpdates在 Xcode 9 最终版本中对我有用

Verify You Can Build an auto-signing Xcode Project Using Xcode IDE

验证您可以使用 Xcode IDE 构建自动签名的 Xcode 项目

  • 1) Open an Xcode project configured for automatically sign
    • Select target from Targets > General > Signing
    • [x] Automatically manage signing
    • Enter your team account credentials
  • 2) Build the project and verify build succeeds
  • 1)打开一个配置为自动签名的Xcode项目
    • 目标 > 常规 > 签名中选择目标
    • [x] 自动管理签名
    • 输入您的团队帐户凭据
  • 2)构建项目并验证构建成功

Close Xcode and Build project using xcodebuild with options -allowProvisioningUpdates

使用带有选项 -allowProvisioningUpdates 的 xcodebuild 关闭 Xcode 和 Build 项目

  • 1) Add option "xcodebuild ... -allowProvisioningUpdates
  • 2) When prompted, "xcode wants to access key "xcode apple id access" in your keychain"
    • Enter credentials and press button Always Allow
  • 1)添加选项“xcodebuild ... -allowProvisioningUpdates
  • 2) 提示时,“xcode 想要访问钥匙串中的密钥“xcode apple id access””
    • 输入凭据并按下按钮始终允许

Now Jenkins command line builds should work.

现在 Jenkins 命令行构建应该可以工作了。

回答by spikalev

I used to have the same issue after recent update from XCode 7.x to 9.3 version.

最近从 XCode 7.x 更新到 9.3 版本后,我曾经遇到过同样的问题。

The solution for me was an parameter -allowProvisioningDeviceRegistrationin addition to -allowProvisioningUpdatesfor xcodebuilder:

对我来说,解决方案是一个参数-allowProvisioningDeviceRegistration除了-allowProvisioningUpdates为xcodebuilder:

/usr/bin/xcodebuild -exportArchive \
-allowProvisioningUpdates -allowProvisioningDeviceRegistration \
...

Works perfectly with Jenkins.

与詹金斯完美配合。

回答by Artyom Devyatov

I've fixed this. The problem was that I specified the team using team_idFastlane command. You should use enable_automatic_code_signinginstead. Also, configuration was not specified. Now I have this script:

我已经解决了这个问题。问题是我使用team_idFastlane 命令指定了团队。你应该enable_automatic_code_signing改用。此外,未指定配置。现在我有这个脚本:

    enable_automatic_code_signing(
        team_id: <YOUR_TEAM_ID_REQUIRED_HERE>,
    )
    gym(
        scheme: <YOUR_SCHEME_REQUIRED HERE>,
        configuration: <YOUR_CONFIGURATION_REQUIRED HERE>,
        export_method: "development",
        xcargs: "-allowProvisioningUpdates",
    )

Also, I'v found thispage. I've tried it at the same time with changes above, so I don't know what helped me. But I've reverted the change from the page and it still works. So I assume the problem was with team_idand configuration.

另外,我找到了这个页面。我同时尝试了上面的更改,所以我不知道是什么帮助了我。但是我已经从页面恢复了更改,它仍然有效。所以我认为问题出在team_idand 上configuration

回答by Max

Xcode saves the credentials in the default keychain. In order for it to access it over ssh, you first need to unlock that keychain:

Xcode 将凭据保存在默认钥匙串中。为了让它通过 ssh 访问它,您首先需要解锁该钥匙串:

/usr/bin/security unlock-keychain /Users/xxx/Library/Keychains/login.keychain-db

/usr/bin/security unlock-keychain /Users/xxx/Library/Keychains/login.keychain-db

When using jenkins, you need to unlock the keychain either inside your build jobs or when starting the agent. You could for example add it to /Library/Application Support/Jenkins/jenkins-slave-runner.sh.

使用 jenkins 时,您需要在构建作业中或在启动代理时解锁钥匙串。例如,您可以将其添加到/Library/Application Support/Jenkins/jenkins-slave-runner.sh.

The answer from "Ed of the Montain" only works, because xcodebuild checks the /Library/MobileDevice/ProvisioningProfiles(and other) directories for valid profiles, if it finds one, then the -allowProvisioningUpdatesoption simply uses this profile and doesn't need the login.

“Ed of the Montain”的答案仅有效,因为 xcodebuild 检查/Library/MobileDevice/ProvisioningProfiles(和其他)目录中的有效配置文件,如果找到,则该-allowProvisioningUpdates选项仅使用此配置文件,不需要登录。

回答by JW.

When you're dealing with Xcode errors over SSH, it's usually best to try out the same commands using the GUI. It will often show you which keychain entries it's trying to access.

当您通过 SSH 处理 Xcode 错误时,通常最好使用 GUI 尝试相同的命令。它通常会向您显示它试图访问的钥匙串条目。

In my case, it prompted me to allow xcodebuild access to Xcode-AlternateDSIDand Xcode-Tokenin my keychain. I granted it access with "Always Allow". You could also edit those entries in Keychain Access and allow all applications to access them, if you're not too worried about security.

就我而言,它促使我允许xcodebuild联编访问Xcode-AlternateDSIDXcode-Token在我的钥匙串。我通过“始终允许”授予它访问权限。如果您不太担心安全性,您还可以在 Keychain Access 中编辑这些条目并允许所有应用程序访问它们。

I was already running security unlock-keychain -p mypassword /Users/myuser/Library/Keychains/login.keychain-dbbefore running xcodebuild, so that's probably also necessary.

security unlock-keychain -p mypassword /Users/myuser/Library/Keychains/login.keychain-db在运行 xcodebuild 之前我已经在运行,所以这可能也是必要的。

After doing that, the export worked.

这样做之后,导出工作了。