Andrew Lombard
Andrew Lombard

Reputation: 439

Azure Devops Pipelines - Xcode project with multiple provisioning profiles fails archive and sign

I'm new to DevOps so please go easy on me if I've missed something basic :)

I’m using the following in Azure Pipelines: Hosted MacOS with an Xcode Build Agent (Xcode Version 5.142.0)

I've just started trying to set up a pipeline for an Xcode based project which uses multiple provisioning profiles. In my scenario I have profiles for the following in my app:

I've followed the instructions for setting up certs and provisioning profiles here (although my project uses automatic signing): https://learn.microsoft.com/en-us/azure/devops/pipelines/apps/mobile/app-signing?view=vsts&tabs=apple-install-during-build

These are being installed correctly to a hosted build agent (no errors) and the build is proceeding perfectly until signing.

During signing it seems that the none of the targets can find their provisioning profiles (both when using 'manual' and 'automatic' assignment).

Here's what is run in the logs:

[command]/usr/bin/xcodebuild -workspace /Users/vsts/agent/2.142.1/work/1/s/*MYAPP**.xcworkspace -scheme **MYAPP** archive -sdk iphoneos -configuration Release -archivePath /Users/vsts/agent/2.142.1/work/1/s/**MYAPP** CODE_SIGN_STYLE=Manual PROVISIONING_PROFILE= PROVISIONING_PROFILE_SPECIFIER= | /usr/local/bin/xcpretty --no-color

Then later when it comes to archiving the following occurs for each scheme:

error: "xxx Today Widget" requires a provisioning profile with the Push Notifications and App Groups features. Select a provisioning profile for the "Release" build configuration in the project editor. (in target 'xxx Today Widget')

A few questions:

  1. Is there an updated guide anyone can point me to? This seems like a common use case and I'm obviously missing something.

  2. Alternatively is there a way to force which profile gets used for which scheme when archiving and signing multiple schemes in the same build?

  3. Is automatic signing an option in pipelines?

For completeness I've seen what looks like a somewhat similar issue here: https://github.com/Microsoft/azure-pipelines-tasks/issues/964 but it's been closed for more than two years.

Upvotes: 5

Views: 9578

Answers (3)

Sethmr
Sethmr

Reputation: 3074

Make sure to correctly target your Project's .xcworkspace file instead of letting it default to <Project Name>.xcodeproj/project.xcworkspace. This haunted me for two days while testing.

Example:

- task: Xcode@5
  inputs:
    sdk: '$(sdk)'
    scheme: '$(scheme)'
    configuration: '$(configuration)'
    xcWorkspacePath: '**/<Project Name>.xcworkspace' # Make sure this line is here
    xcodeVersion: 'default' # Options: default, 10, 9, 8, specifyPath
    exportPath: '$(agent.buildDirectory)/output/$(sdk)/$(configuration)'

Upvotes: 1

Keith Clark
Keith Clark

Reputation: 121

Here's how we got building an iOS app with multiple provisioning profiles to work in Azure DevOps.

  • Ensure you have the Apple App Store Azure DevOps extension written by Microsoft installed in your account.
  • Install all of the provisioning profiles that are needed using multiple Install Apple Provisioning Profile tasks
  • Add the Xcode build task and configure it with your workspace/project settings
  • Set the "Signing style" to "Automatic signing" and provide your team ID in the "Team ID" field under the "Signing & provisioning" section
  • Create a .plist file, configure it similar to the following, and put it somewhere (your code repository, secure files, etc). This example is of a watch app, but could be any scenario where multiple provisioning profiles are necessary. You can find a provisioning profile's UUID by opening it in a text editor and looking for the "UUID" key.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>provisioningProfiles</key>
        <dict>
            <key>YOUR_BUNDLE_ID.watchkitapp.watchkitextension</key>
            <string>UUID_OF_ASSOCIATED_PROVISIONING_PROFILE</string>
            <key>YOUR_BUNDLE_ID.watchkitapp</key>
            <string>UUID_OF_ASSOCIATED_PROVISIONING_PROFILE</string>
            <key>YOUR_BUNDLE_ID</key>
            <string>UUID_OF_ASSOCIATED_PROVISIONING_PROFILE</string>
        </dict>
        <key>signingCertificate</key>
        <string>iOS Distribution</string>
        <key>signingStyle</key>
        <string>manual</string>
        <key>method</key>
        <string>app-store</string>
        <key>teamID</key>
        <string>YOUR_TEAM_ID</string>
    </dict>
    </plist>
  • Under the "Package options" section, specify "Plist" in the "Export options" field and provide a path to the .plist you created in the "Export options plist" field

Upvotes: 12

Andrew Lombard
Andrew Lombard

Reputation: 439

it turns out after closer inspection the development certificate I had been using was the wrong one (there were a few on my Mac). I swapped this for the appropriate version and the issues went away.

I can now successfully build, archive and sign.

Hopefully this helps someone.

Andrew

Upvotes: 0

Related Questions