-allowProvisioningUpdates不起作用

Tra*_*tec 19 xcode continuous-integration ios xcode9

我们使用Jenkins进行连续集成.为了编译我们的应用程序,我们需要做的一切都是通过命令行(bash脚本)完成的,因为我们有几台机器可以完成构建而无需人工访问设备.

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

我明白,我需要将Apple ID的凭据添加到XCode设置中.

凭据将添加到"首选项"中的"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 'xxx@yyy.com'.\" UserInfo={NSLocalizedFailureReason=Unable to log in with account 'xxx@yyy.com'., NSLocalizedRecoverySuggestion=The login details for account 'xxx@yyy.com' were rejected., DVTDeveloperAccountErrorAccount=<DVTAppleIDBasedDeveloperAccount 0x7fe179b016c0: username: xxx@yyy.com>, NSUnderlyingError=0x7fe179e8ee60 {Error Domain=DVTDeveloperAccountErrorDomain Code=4 \"xxx@yyy.com could not sign in.\" UserInfo={NSLocalizedRecoverySuggestion=Cannot sign in to this account. Try signing into it again in the Accounts preference pane., NSLocalizedDescription=xxx@yyy.com could not sign in., DVTDeveloperAccountErrorAccount=<DVTAppleIDBasedDeveloperAccount 0x7fe179b016c0: username: xxx@yyy.com>}}}",  
    "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 'xxx@yyy.com'.
Run Code Online (Sandbox Code Playgroud)

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

更新:我们使用这个插件启动我们的Jenkins奴隶的ssh会话,以便进行buildjob:https://wiki.jenkins.io/display/JENKINS/SSH+Slaves+plugin

Art*_*tov 6

我已经解决了这个问题。问题是我使用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",
    )
Run Code Online (Sandbox Code Playgroud)

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


小智 5

我也有同样的问题。我向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*
Run Code Online (Sandbox Code Playgroud)


Ed *_*ain 4

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

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

  • 1)打开配置为自动签名的Xcode项目
    • 从“目标”>“常规”>“签名”中选择目标
    • [x] 自动管理签名
    • 输入您的团队帐户凭据
  • 2)构建项目并验证构建是否成功

使用带有选项 -allowProvisioningUpdates 的 xcodebuild 关闭 Xcode 并构建项目

  • 1)添加选项“xcodebuild ... -allowProvisioningUpdates
  • 2)出现提示时,“xcode想要访问钥匙串中的密钥“xcode apple id access””
    • 输入凭据并按“始终允许”按钮

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