0
votes

I am having an issue with an Azure DevOPS pipeline for an Xcode iOS app. I have created the pipeline from scratch and it uses a yaml file where I define the build as well as the signing and provisioning based on Microsoft's official documentation. The build uses XcodeVersion=10 with CocoaPods and implements signing and provisioning. I have no problem with the pre-installation of the P12 cert, the build pulls it the from the Secure Files library and installs it successfully.

What's giving me an issue is the provisioning profile. I must be doing something wrong on the InstallAppleProvisioningProfile@1 task or in the configuration of the ProvisioningProfileUuid in the Xcode task because the build throws the following error on the Xcode task:

❌ error: "Register" requires a provisioning profile with the Wireless Accessory Configuration feature. Select a provisioning profile for the "Release" build configuration in the project editor. (in target 'Register')

I have tried setting the provProfileSecureFile setting of the InstallAppleProvisioningProfile@1 task to point to both a '.provisionprofile' and a '.mobileprovision' file but I still see no command being executed in the logs. The app can be built, signed and provisioned based on the 'MyProvisioning_Profile.mobileprovision' locally without a problem.

pool:
    vmImage: 'macOS-10.13'

variables:
    scheme: ''
    sdk: 'iphoneos'
    configuration: 'Release'

steps:
# Install an Apple certificate required to build on a macOS agent
- task: InstallAppleCertificate@2
    inputs:
    certSecureFile: 'MyProductionCert.p12'
    certPwd: $(P12password)

# Install an Apple provisioning profile required to build on a macOS agent
- task: InstallAppleProvisioningProfile@1
inputs:
    provisioningProfileLocation: 'Secure Files'
    provProfileSecureFile: 'MyProvisioning_Profile.provisionprofile'
    removeProfile: false

- task: Xcode@5
inputs:
    sdk: '$(sdk)'
    configuration: '$(configuration)'
    xcodeVersion: '10' 
    exportPath: '$(agent.buildDirectory)/output/$(sdk)/$(configuration)'
    packageApp: false
    xcWorkspacePath: 'Register.xcworkspace' 
    scheme: 'Register'
    signingOption: 'manual' 
    signingIdentity: $(APPLE_CERTIFICATE_SIGNING_IDENTITY)
    provisioningProfileUuid: $(APPLE_PROV_PROFILE_UUID)

I would expect to see at least a command being executed from the InstallAppleProvisioningProfile@1 task but what I see are 2 successful, but empty tasks in the logs: 1. Pre-job: InstallAppleProvisioningProfile 2. InstallAppleProvisioningProfile

The Azure DevOPS Xcode task then fails with this error:

2019-02-08T01:35:05.1819530Z [command]/usr/bin/xcodebuild -sdk iphoneos -configuration Release -workspace /Users/vsts/agent/2.146.0/work/1/s/Register.xcworkspace -scheme Register build CODE_SIGN_STYLE=Manual CODE_SIGN_IDENTITY=iPhone Distribution: [MyCompany LLC] ([MyTeamID]) PROVISIONING_PROFILE= PROVISIONING_PROFILE_SPECIFIER= | /usr/local/lib/ruby/gems/2.6.0/bin/xcpretty -r junit --no-color
2019-02-08T01:35:10.6519500Z ❌  error: "Register" requires a provisioning profile with the Wireless Accessory Configuration feature. Select a provisioning profile for the "Release" build configuration in the project editor. (in target 'Register')
2019-02-08T01:35:10.6560090Z ** BUILD FAILED **

Has anybody using Azure pipelines has seen this issue before? How can I fix it?

4
Thanks @Cœur I just updated the question to fix the one misspelling I had in the text of the question. The yaml was correct though so this would not help my problem. Would appreciate any help from anybody who has set up an xcode pipeline in Azure devOPS or the old VSTS before.Karen Perez Diaz

4 Answers

0
votes

You need to use the GUID of the provisioning profile file (same for the Signing Certificate), not its file name.

If you view the file details in Azure DevOps (Pipelines > Library > Secure Files > {Your provisioning profile file}) you can get the GUID in the URL from the secureFileId query string parameter.

0
votes

You can find the profile GUID when you run once the Pipeline with the InstallAppleProvisioningProfile@1 task. (In my experience, the GUID in the URL from SecureFiles is a GUID from Azure Pipelines and has nothing to do with the provisioning profile GUID.

If you've uploaded the provisioning profile to the pipeline's Secure Files and have the following in your pipeline:

- task: InstallAppleProvisioningProfile@1
  displayName: 'Install Ad Hoc Apple Provisioning Profile'
  inputs:
    provisioningProfileLocation: 'secureFiles'
    provProfileSecureFile: 'SomeProfile.mobileprovision'

You will see something like this in the logs of the pipeline:

sr/libexec/PlistBuddy -c Print UUID _xcodetasktmp.plist
12345678-abcd-1234-abcd-1234567890ab
sr/libexec/PlistBuddy -c Print Name _xcodetasktmp.plist
Company Profile iOS Distribution or Ad-Hoc

copy the profile GUID from there, update your pipeline and try again.

My configuration of the XCode task looks as follows:

- task: Xcode@5
  displayName: 'Build React Native for iOS'
  inputs:
    actions: 'build'
    scheme: 'AwesomeAppNative'
    sdk: 'iphoneos'
    configuration: 'Release'
    xcWorkspacePath: './ios/AwesomeAppNative.xcworkspace'
    xcodeVersion: '10' # Options: 8, 9, 10, default, specifyPath
    args: '-UseModernBuildSystem=N' # See https://github.com/facebook/react-native/issues/20492
    useXcpretty: 'false' 
    signingOption: 'manual' # Options: nosign, default, manual, auto
    signingIdentity: 'Certificate identity name (<TEAMID>)'
    provisioningProfileUuid: 12345678-abcd-1234-abcd-1234567890ab # Ad Hoc
    # provisioningProfileName: DONT PUT THE NAME HERE IT WOULD TAKE PRECENDENCE
    # teamId: <TEAMIDFromCertificat> # for signingOption: auto
    packageApp: 'true' # Package the app
    exportOptions: 'auto'
0
votes

I found that using the GUID from the field in the URL didnt; work.

This worked for me to get the correct UUID of the folder:

  1. Navigate to ~/Library/MobileDevice/Provisioning Profiles/
  2. If you have more than one, then backup them up (eg via Zip file and then unzip will be restore the files after the following steps)
  3. Delete them all
  4. Download the Provisioning Profile from developer.apple.com
  5. Double click on the downloaded .mobileprovision file
  6. The latest added file is the with the GUID as the filename will be the UUID. Copy this UUID.
  7. Restore the previous profiles if need be by unzipping your backup.
0
votes

If you're using the Install Apple Provisioning Profile Task the variable $(APPLE_PROV_PROFILE_UUID) is automatically set by the task.

You should use this rather than manually getting it out of the logs as this will still work when you replace the profile when it expires.

Official Microsoft documentation shows it here (towards the bottom of the page).

Likewise $(APPLE_CERTIFICATE_SIGNING_IDENTITY) is set for the certificate.