【问题标题】:-allowProvisioningUpdates doesn't work-allowProvisioningUpdates 不起作用
【发布时间】:2018-02-27 22:26:32
【问题描述】:

我们正在使用 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'.

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

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

【问题讨论】:

    标签: ios xcode continuous-integration xcode9


    【解决方案1】:

    这似乎是一个老问题。但我今天来到这里是因为我遇到了同样的问题。由于“allowProvisioningUpdates 不起作用”,我无法在模拟器上运行颤振应用。

    无论如何,我终于通过在 Xcode 上打开 Flutter 应用解决了这个问题。然后在 Xcode 上更新我的帐户偏好。看来您必须不时手动登录 Apple ID 帐户。

    谢谢,

    【讨论】:

      【解决方案2】:

      我已经解决了这个问题。问题是我使用team_id Fastlane 命令指定了团队。您应该改用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",
          )
      

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

      【讨论】:

        【解决方案3】:

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

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

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

        与 Jenkins 完美配合。

        【讨论】:

          【解决方案4】:

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

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

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

          完成后,导出工作。

          【讨论】:

            【解决方案5】:

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

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

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

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

            【讨论】:

              【解决方案6】:

              我也有同样的问题。我向苹果报告了这个错误,但无济于事。为了继续使用 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*
              

              【讨论】:

                【解决方案7】:

                这个 -allowProvisioningUpdates 在 Xcode 9 最终版本中为我工作。

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

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

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

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

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

                【讨论】:

                • 我按照您建议的步骤操作,当我在机器上执行 xcodebuild local 时会询问凭据,但是当我通过 Jenkins 构建它时,我收到相同的错误消息“无法使用帐户 'xxx@ 登录yyy.com'。”。也许这与我们的 Jenkins 设置有关(我们使用没有 UI 的 ssh 会话在我们的 macOS 从属设备上构建作业。请参阅上面的更新)。
                • 我不知道 ssh 或 running headless 是否相关。目前,我无法让 macOS High Sierra 在 ESXi 6.0 下启动。研究如何将我的 Mac Mini ESXi 主机升级到 6.5。
                猜你喜欢
                • 2022-06-20
                • 1970-01-01
                • 2016-03-13
                • 1970-01-01
                • 1970-01-01
                • 2016-09-12
                • 1970-01-01
                • 1970-01-01
                • 1970-01-01
                相关资源
                最近更新 更多