如何在 Azure Pipeline 中为 iOS 构建使用自动配置

How to use automatic provisioning for iOS builds in Azure Pipeline

我正在尝试为 iOS 构建使用自动配置。在我的 Mac 上它工作正常,但是当我尝试在 Azure 管道上执行它时我收到以下错误

error: There are no accounts registered with Xcode. Add your developer account to Xcode (in target 'XXX' from project 'XXXX')
error: No profiles for 'com.devhaus.ljdev' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.XXXX'. (in target 'XXXX' from project 'XXXX')

在我的 yaml 中,我只有 InstallAppleCertificate 成功运行的任务

          - task: InstallAppleCertificate@2
            inputs:
              certSecureFile: $(p12File)
              certPwd: $(p12Password)

          - script: |
              npx run ionic build 
            displayName: "build"

          - script: |
              npx ionic cordova platform add ios@6
            displayName: "build for Apple"

# Didn't just do npx ionic cordova build ios here as there 
# is a bug that will cause the build to hang.

          - script: |
              npx cordova build ios --device
            displayName: "build for IOS"

this thread 中提到自动签名仅适用于开发版本。您不能在 DevOps 管道中使用自动签名进行分发(临时、应用商店等)。

但是,您始终可以通过为构建命令指定 codeSignIdentityprovisioningProfile 参数来手动签署 ios。对于下面的示例命令。请参阅 cordova 文档 Signing an App

 npx cordova build ios --device --codeSignIdentity="$(APPLE_CERTIFICATE_SIGNING_IDENTITY)" --provisioningProfile="$(APPLE_PROV_PROFILE_UUID)"

当您使用 安装 Apple 证书安装 Apple 配置文件 任务在 azure devops 管道中下载证书和配置文件时。变量 $(APPLE_CERTIFICATE_SIGNING_IDENTITY)$(APPLE_PROV_PROFILE_UUID) 由这些任务自动设置,允许您直接引用签名身份和配置文件 UUID。请参阅 Microsoft 文档 here.

In the Signing identity field, enter $(APPLE_CERTIFICATE_SIGNING_IDENTITY). This variable is automatically set by the Install Apple Certificate task for the certificate you selected.

In the Provisioning profile UUID field, enter $(APPLE_PROV_PROFILE_UUID). This variable is automatically set by the Install Apple Provisioning Profile task for the provisioning profile you selected.