ios azure pipeline build fails with build with error no team ID found in the archive

Viewed 1049

I am using azure pipeline to create CI for iOS and my repository depend on swift code and after running the build I got this error in the Xcode archive task

Error Domain=IDEFoundationErrorDomain Code=1 "No 'teamID' specified and no team ID found in the archive" UserInfo={NSLocalizedDescription=No 'teamID' specified and no team ID found in the archive}

I am using arg in the Xcode archive tasks

steps:
- task: Xcode@5
  displayName: 'Xcode archive'
  inputs:
    actions: archive
    xcWorkspacePath: '*.xcworkspace'
    scheme: '$(SchemeName)'
    packageApp: true
    args: '-UseModernBuildSystem=0  '
2 Answers

You might need to set the exportOptions to specify and set the attributes teamId and exportMethod for Xcode task. See below example:

steps:
- task: Xcode@5
  displayName: 'Xcode archive'
  inputs:
    actions: archive
    xcWorkspacePath: '*.xcworkspace'
    scheme: '$(SchemeName)'
    packageApp: true
    args: '-UseModernBuildSystem=0'
    exportOptions: 'specify'
    exportMethod: 'app-store'
    teamId: "Team Id" 
    exportTeamId: "Team Id"

See here for more information about xcode task.

Install certificates and provisioning profile

To sign your application you will need to install the certificate and provisioning profile that we have already imported into the Azure dashboard as a Secure-Files

- task: InstallAppleCertificate@2
  inputs:
    # Select the certificate (.p12) that was uploaded to Secure Files to install on the macOS agent.
    certSecureFile: 'Certificate.p12' 
    # Password to the Apple certificate (.p12). Use a new build variable with its lock enabled on the Variables tab to encrypt this value.
    certPwd: '$(P12password)'
    # Select the keychain in which to install the Apple certificate. You can choose to install the certificate in a temporary keychain (default), the default keychain or a custom keychain. A temporary keychain will always be deleted after the build or release is complete.
    keychain: 'temp'
    # Select to delete the certificate from the keychain after the build or release is complete. This option is visible when custom keychain or default keychain are selected.
    deleteCert: true

- task: InstallAppleProvisioningProfile@1
  inputs:
  # Select the location of the provisioning profile to install. The provisioning profile can be uploaded to Secure Files or stored in your source repository or a local path on the agent.
    provProfileSecureFile: 'my-provisioning-profile.mobileprovision'
Related