Azure DevOps Two Provisioning Profiles for iOS App - ios

I am very lost and haven't been able to find a huge amount of material on this matter.
I am creating a CI/CD pipeline for an iOS app that has two provisioning profiles, one for the main app and an additional one for widgets. I am installing both provisioning profiles, one after another like this:
- task: InstallAppleProvisioningProfile#1
inputs:
provisioningProfileLocation: 'secureFiles'
provProfileSecureFile: '$(provisioningProfile)'
removeProfile: true
displayName: "Install Main Provisioning Profile"
- task: InstallAppleProvisioningProfile#1
inputs:
provisioningProfileLocation: 'secureFiles'
provProfileSecureFile: '$(provisioningProfileWidgets)'
removeProfile: true
displayName: "Install Widget Provisioning Profile"
But when I run the Xcode task, I am failing with the error:
error: No signing certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID "[team id]" with a private key was found.
I am assigning provisioning profiles through a plist which looks like this:
<?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>[main app]</key>
<string>[uuid]/string>
<key>[widgets]</key>
<string>[uuid]</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>[team id]</string>
</dict>
</plist>
My Xcode task looks like this:
- task: Xcode#5
inputs:
actions: '-allowProvisioningUpdates clean build'
scheme: '$(scheme)'
sdk: '$(sdk)'
configuration: '$(configuration)'
xcWorkspacePath: '$(workspace)'
xcodeVersion: 'default'
packageApp: true
signingOption: 'manual'
exportOptions: 'plist'
exportOptionsPlist: '$(devPlist)'
displayName: "Build and Sign"
If I change signingOption to 'auto' I get the error above and other's such as:
No profiles for '*****' were found: Xcode couldn't find any iOS App Development provisioning profiles matching '******'.
error: There are no accounts registered with Xcode. Add your developer account to Xcode
I've been on this for a couple of days, but every tutorial just seems to be using a single provisioning profile, and I'm really stumped on what to do next, so any help would be greatly appreciated.
This is the tutorial I have been trying to follow as much as possible, https://damienaicheh.github.io/ios/azure/devops/2019/12/05/build-sign-your-ios-application-using-azure-devops-en.html, and this is where I got the plist idea from, Azure Devops Pipelines - Xcode project with multiple provisioning profiles fails archive and sign.
Thanks 😊

I was searching through the internet for couple of days without any results.
After a week of investigation I figured out that problem in my case was related to the configurations in my project:
I was needed to set Signing as Apple Distribution for Release configuration in Build Settings both for app and extension
Example: Manual signing
Second think is related to pipelines configuration.
I did exactly the same as this guy How to create plist file with profiles recommended, but for me "Signing style" worked only with "Project Defaults":how to setup Xcode task
Note: It is very important to correctly configure your export option plist file.
I hope it will help and make someone's life easier.

Related

Codemagic - "Runner.app" requires a provisioning profile with the Push Notifications feature

I'm trying to set up codemagic ios flow. I want to build ipa and push it to TestFlight. I've created codemagic api key in AppStoreConnect, and created Developer & Distribution Certificates via Codemagic interface by Generating a new code signing certificate option. I also created a Provisioning profile for my app and it says that Push Notification Capability is enabled.
But when I start the process I have an error:
Encountered error while creating the IPA:
error: exportArchive: "Runner.app" requires a provisioning profile with the Push Notifications feature.
I'm new to codemagic and tried to do all steps by docs, but I can't understand this problem :( Maybe someone can help to fix the problem?
This is my flow:
ios-workflow-id:
name: iOS Sample Workflow
integrations:
app_store_connect: CodeMagic
environment:
vars:
APP_ID: #########
ios_signing:
provisioning_profiles:
- Codemagic
certificates:
- Development_Certificate
- Distribution_Certificate
scripts:
- name: Set up code signing settings on Xcode project
script: |
xcode-project use-profiles
- name: Get Flutter packages
script: |
flutter packages pub get
- name: Install pods
script: |
find . -name "Podfile" -execdir pod install \;
- name: Flutter build ipa
script: |
BUILD_NUMBER=$(($(app-store-connect get-latest-app-store-build-number "$APP_ID") + 1))
flutter build ipa --release \
--build-name=1.0.0 \
--build-number=$BUILD_NUMBER
artifacts:
- build/ios/ipa/*.ipa
publishing:
app_store_connect:
auth: integration
submit_to_testflight: true
Code signing logs:
Configure code signing settings
Searching for files matching /Users/builder/Library/MobileDevice/Provisioning Profiles/*.mobileprovision
Searching for files matching /Users/builder/Library/MobileDevice/Provisioning Profiles/*.provisionprofile
List available code signing certificates in keychain /Users/builder/Library/codemagic-cli-tools/keychains/03-02-23_smdje8o8.keychain-db
Searching for files matching /Users/builder/clone/**/*.xcodeproj
Completed configuring code signing settings
- Using profile "Codemagic" [717112ed-c3ca-45b5-946a-efe6d07dffcc] for target "Runner" [Debug] from project "Runner"
- Using profile "Codemagic" [717112ed-c3ca-45b5-946a-efe6d07dffcc] for target "Runner" [Profile] from project "Runner"
- Using profile "Codemagic" [717112ed-c3ca-45b5-946a-efe6d07dffcc] for target "Runner" [Release] from project "Runner"
Generated options for exporting the project
- Method: app-store
- Provisioning Profiles:
- com.fdforge.dev: Codemagic
- Signing Certificate: Apple Distribution
- Signing Style: manual
- Team Id: #####
Saved export options to /Users/builder/export_options.plist
Fixed!
I had to create export.plist file:
<?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>compileBitcode</key>
<true/>
<key>method</key>
<string>app-store</string>
<key>provisioningProfiles</key>
<dict>
<key>com.example.appName</key>
<string>Provisioning profile name</string>
</dict>
<key>signingCertificate</key>
<string>iOS Distribution</string>
<key>signingStyle</key>
<string>manual</string>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
<string>your team id</string>
<key>thinning</key>
<string><none></string>
</dict>
</plist>
And changed the command for building IPA:
- name: Flutter build ipa
script: |
flutter build ipa --export-options-plist ios/export.plist --build-number=5 --build-name=1.0.0 --release
And it works!)

Azure Devops Pipelines - Xcode project with multiple provisioning profiles

I have configured pipeline to build an iOS app that is also an AUv3 plugin, it requires two provisioning profiles but I can't manage the Plist to allow the signature for both.
I have installed .p12 and Apple Provisioning Profiles.
This is my Xcode task:
steps:
- task: Xcode#5
displayName: 'Xcode build'
inputs:
actions: 'build'
sdk: iphoneos13.7
xcWorkspacePath: β€˜project_name/project.xcworkspace'
scheme: 'project_name - All'
packageApp: true
exportPath: output/
exportOptions: plist
exportOptionsPlist: β€˜file.plist'
signingOption: auto
teamId: [10-character development team ID]
useXcpretty: false
And here is my .plist file:
<?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>com.company.product_name</key>
<string>UUID_Code</string>
<key>com.company.product_name.product_nameAUv3</key>
<string>UUID_Code</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>**********</string>
</dict>
</plist>
but Xcode project with multiple provisioning profiles fails archive and sign:
Code Signing Error: No profiles for 'com.company.product_name.product_nameAUv3' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'com.company.product_name.product_nameAUv3'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.
Code Signing Error: Code signing is required for product type 'App Extension' in SDK 'iOS 13.7'
Someone have similar setup? This seems I'm missing something.

Azure Devops macOS Pipeline fails on hosted with missing provisioning profile

I am running a Azure DevOps Pipeline which generates an .ipa file. This runs on my local agent without any issues, but when I run it on a hosted macOS 10.15 machine, i'll get an error, that the provisioning profile is missing
❌ error: No profiles for 'app.zookeeper.platypus' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'app.zookeeper.platypus'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'Runner' from project 'Runner')
- task: InstallAppleProvisioningProfile#1
displayName: 'Install an Apple provisioning profile'
inputs:
provProfileSecureFile: App.mobileprovision
- task: InstallAppleCertificate#2
displayName: 'Install an Apple certificate'
inputs:
certSecureFile: 'Certs.p12'
certPwd: xxx
- task: Xcode#5
displayName: 'Xcode archive'
inputs:
actions: archive
xcWorkspacePath: 'src/Apps/App/ios/Runner.xcworkspace'
scheme: Runner
packageApp: true
archivePath: 'src/Apps/App/ios/Runner.xcarchive'
exportPath: '$(build.artifactstagingdirectory)'
signingOption: auto
Here's the output of the install provisioning profile task
Starting: Install an Apple provisioning profile
==============================================================================
Task : Install Apple provisioning profile
Description : Install an Apple provisioning profile required to build on a macOS agent machine
Version : 1.171.0
Author : Microsoft Corporation
Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/install-apple-provisioning-profile
==============================================================================
/usr/bin/security cms -D -i /Users/runner/work/_temp/platypus.mobileprovision
<?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>AppIDName</key>
<string>Platypus identifier</string>
<key>ApplicationIdentifierPrefix</key>
<array>
<string>UM3UVMPGY5</string>
</array>
<key>CreationDate</key>
<date>2020-07-31T14:08:38Z</date>
<key>Platform</key>
<array>
<string>iOS</string>
</array>
<key>IsXcodeManaged</key>
<false/>
<key>DeveloperCertificates</key>
<array>
<data>MIIF...</data> <- shortened for better reading
<data>MIIF...</data> <- shortened for better reading
<data>MIIF...</data> <- shortened for better reading
</array>
<key>Entitlements</key>
<dict>
<key>application-identifier</key>
<string>UM3UVMPGY5.app.zookeeper.platypus</string>
<key>keychain-access-groups</key>
<array>
<string>UM3UVMPGY5.*</string>
<string>com.apple.token</string>
</array>
<key>get-task-allow</key>
<true/>
<key>com.apple.developer.team-identifier</key>
<string>UM3UVMPGY5</string>
<key>com.apple.developer.authentication-services.autofill-credential-provider</key>
<true/>
</dict>
<key>ExpirationDate</key>
<date>2021-07-31T14:08:38Z</date>
<key>Name</key>
<string>platypus</string>
<key>ProvisionedDevices</key>
<array>
<string>00008030-0011193A11D8802E</string>
</array>
<key>TeamIdentifier</key>
<array>
<string>UM3UVMPGY5</string>
</array>
<key>TeamName</key>
<string>Daniel Martin</string>
<key>TimeToLive</key>
<integer>365</integer>
<key>UUID</key>
<string>19e4f1a2-a4fd-42f6-ac17-b8bc864fa1d7</string>
<key>Version</key>
<integer>1</integer>
</dict>
/usr/libexec/PlistBuddy -c Print UUID _xcodetasktmp.plist
19e4f1a2-a4fd-42f6-ac17-b8bc864fa1d7
/usr/libexec/PlistBuddy -c Print Name _xcodetasktmp.plist
platypus
/bin/rm -f _xcodetasktmp.plist
/bin/cp -f /Users/runner/work/_temp/platypus.mobileprovision /Users/runner/Library/MobileDevice/Provisioning Profiles/19e4f1a2-a4fd-42f6-ac17-b8bc864fa1d7.mobileprovision
Finishing: Install an Apple provisioning profile
And the failing XCOde archive task:
Starting: Xcode archive
==============================================================================
Task : Xcode
Description : Build, test, or archive an Xcode workspace on macOS. Optionally package an app.
Version : 5.170.2
Author : Microsoft Corporation
Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/build/xcode
==============================================================================
/usr/bin/xcodebuild -version
Xcode 11.3.1
Build version 11C505
/usr/bin/xcodebuild -configuration $(Configuration) -workspace /Users/runner/work/1/s/src/Apps/platypus_app/ios/Runner.xcworkspace -scheme Runner archive CODE_SIGN_STYLE=Automatic | /usr/local/lib/ruby/gems/2.6.0/bin/xcpretty -r junit --no-color
❌ error: No profiles for 'app.zookeeper.platypus' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'app.zookeeper.platypus'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'Runner' from project 'Runner')
** ARCHIVE FAILED **
##[error]Error: /usr/bin/xcodebuild failed with return code: 65
Finishing: Xcode archive
I am a beginner with Apple certificates, so I think I am missing something here
Thanks for any help!
EDIT
After setting
signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
provisioningProfileUuid: '$(APPLE_PROV_PROFILE_UUID)'
I'll get a bunch of new errors coming up.
❌ error: image_picker does not support provisioning profiles. image_picker does not support provisioning profiles, but provisioning profile platypus has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'image_picker' from project 'Pods')
❌ error: flutter_secure_storage does not support provisioning profiles. flutter_secure_storage does not support provisioning profiles, but provisioning profile platypus has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'flutter_secure_storage' from project 'Pods')
❌ error: MTBBarcodeScanner does not support provisioning profiles. MTBBarcodeScanner does not support provisioning profiles, but provisioning profile platypus has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'MTBBarcodeScanner' from project 'Pods')
❌ error: sqflite does not support provisioning profiles. sqflite does not support provisioning profiles, but provisioning profile platypus has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'sqflite' from project 'Pods')
❌ error: Pods-Runner does not support provisioning profiles. Pods-Runner does not support provisioning profiles, but provisioning profile platypus has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'Pods-Runner' from project 'Pods')
❌ error: Provisioning profile "platypus" doesn't include signing certificate "iPhone Distribution: Daniel Martin (UM3UVMPGY5)". (in target 'Runner' from project 'Runner')
❌ error: path_provider does not support provisioning profiles. path_provider does not support provisioning profiles, but provisioning profile platypus has been manually specified. Set the provisioning profile value to "Automatic" in the build settings editor. (in target 'path_provider' from project 'Pods')
These are all packages I included into my flutter application.
Make sure you have uploaded provisioning profile & .p12 file to the pipeline library. After that you can include this at the end of your Podfile:
post_install do |installer|
installer.pods_project.build_configurations.each do |config|
config.build_settings['CODE_SIGNING_REQUIRED'] = "NO"
config.build_settings['CODE_SIGNING_ALLOWED'] = "NO"
end
end
For more information, refer to this article
You can check the task log of InstallAppleProvisioningProfile task to see if the provisioning profiles is successfully downloaded in the agent. Make sure the right provisioning profiles is uploaded to the secure file(Pipeline-->Library--Secure files>) and is downloaded to the agent in the runtime.
If the provisioning profiles is successfully downloaded. It might be because the different version of xcode.
You can check the build log to see if the xcode version used by the xcode task in cloud hosted agent is the same with your local agent.
You can use xcodeVersion attribute specify the target version of Xcode for Xcode task.
- task: Xcode#5
displayName: 'Xcode task'
inputs:
xcodeVersion: 11
packageApp: true
signingOption: auto
Update:
If it is not the xcode version issue. You can try setting the provisioningProfileUuid attribute to $(APPLE_PROV_PROFILE_UUID): See below:
- task: Xcode#5
inputs:
signingOption: 'manual'
signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
provisioningProfileUuid: '$(APPLE_PROV_PROFILE_UUID)'
Check here for more information.
Writing this comment in case someone is facing a similar problem.
In my case the problem was that the certificate was Development not Adhoc , so when I created an Adhoc certificate and added it instead of the development one it worked.

How can I configure Azure Pipelines to build an iOS project which uses OneSignal?

I am trying to get Azure Pipelines to work with our iOS project. I have set up a simpler project and all is working fine on the simpler project, but our main app uses OneSignal for notifications. This means there is an extra target and a different provisioning profile. Having read everything I can find to do with provisioning profiles and how to configure the yaml file, I am at a loss.
The best information I could find was here
My YAML file currently looks like this:
pool:
vmImage: 'macOS-10.14'
variables:
- group: ios-pipeline
- name: configuration
value: 'Release'
- name: sdk
value: 'iphoneos'
steps:
- task: InstallAppleCertificate#2
inputs:
certSecureFile: '$(p12FileName)'
certPwd: '$(p12Password)'
keychain: 'temp'
deleteCert: true
- task: InstallAppleProvisioningProfile#1
inputs:
provisioningProfileLocation: 'secureFiles'
provProfileSecureFile: '$(oneSignalProvProfile)'
- task: InstallAppleProvisioningProfile#1
inputs:
provisioningProfileLocation: 'secureFiles'
provProfileSecureFile: '$(provisioningProfile)'
- task: CocoaPods#0
inputs:
forceRepoUpdate: false
- task: Xcode#5
inputs:
actions: 'build'
xcWorkspacePath: '**/PROJECT_NAME.xcworkspace'
scheme: 'SCHEME_NAME'
packageApp: true
exportOptions: 'plist'
exportOptionsPlist: '**/DevOpsOptions.plist'
signingOption: 'auto'
teamId: 'OUR_TEAM_ID'
The plist file reference in the build task contains the following:
<?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>APP_BUNDLE_ID.OneSignalNotificationServiceExtension</key>
<string>THE UUID FOR THIS PROFILE</string>
<key>APP_BUNDLE_ID</key>
<string>THE UUID FOR THIS 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>OUR_TEAM_ID</string>
</dict>
</plist>
I get the following error when I try to run this configuration:
❌ error: No profiles for 'MAIN_APP_BUNDLE_ID' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'MAIN_APP_BUNDLE_ID'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'MAIN_APP_BUNDLE_ID' from project 'PROJECT_NAME')
❌ error: No profiles for 'OneSignalNotificationServiceExtension_BUNDLE_ID' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'OneSignalNotificationServiceExtension_BUNDLE_ID'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'OneSignalNotificationServiceExtension_BUNDLE_ID' from project 'PROJECT_NAME')
I have also tried using a manual signing option using:
- task: Xcode#5
inputs:
actions: 'build'
xcWorkspacePath: '**/WORKSPACE_NAME.xcworkspace'
scheme: 'SCHEME_NAME'
packageApp: true
signingOption: 'manual'
signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
provisioningProfileUuid: '$(APPLE_PROV_PROFILE_UUID)'
When I use this build task, I get an error stating that there is no provisioning profile installed for the OneSignalExtension. Am I flogging a dead horse here or has anyone managed to get this (or something similar) working? Thanks for any assistance anyone can give me!
I thought I had better post my solution to my issue as it has been quite a journey! I tried so many different configurations, but in the end this is what I learned:
I couldn't get Xcode managed profiles to work when there are different provisioning profiles needed to complete the build/sign process.
I cleared all of the expired profiles/certificates from our Apple Dev account and made sure there was just one Apple Developer certificate and one Apple Distribution certificate. I did this to make sure that there was only one possible way to sign our app, and whilst not strictly necessary, it allowed me to eliminate certificates being part of the issue.
I exported both certificates and gave them a password which would be added to the library on Azure later.
I created a manual provisioning profile for the main app which included the Apple Distribution certificate. I created another provisioning profile for the OneSignal app ID, again including the distribution certificate.
I got the UUID for each profile and changed each filename to the UUID.mobileprovision.
Following the advice here, I created a provs.plist file which contained the following:
<?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_APP_ID.OneSignalNotificationServiceExtension</key>
<string>UUID_FOR_ONE_SIGNAL_PROV_PROFILE</string>
<key>YOUR_APP_ID</key>
<string>UUID_FOR_APP_PROV_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>
On Azure Pipelines, I uploaded both certificates and both profiles into the Secure files section of the Library. I also uploaded the provs.plist file.
I created a variable group in the library called ios-pipeline, which contains variable names for the profiles and certificates, as well as the password for the certificates.
Back in XCode, in the main project inspector, I changed the signing for both the main target and the OneSignal target to manual. I had to import the profiles I created earlier to do this.
I then edited the pipeline YAML file to look like so:
pool:
vmImage: 'macOS-10.14'
variables:
- group: ios-pipeline
- name: configuration
value: 'Release'
- name: sdk
value: 'iphoneos'
steps:
- task: InstallAppleCertificate#2
inputs:
certSecureFile: '$(p12FileName)'
certPwd: '$(p12Password)'
keychain: 'temp'
deleteCert: true
- task: InstallAppleCertificate#2
inputs:
certSecureFile: '$(p12DevFileName)'
certPwd: '$(p12Password)'
keychain: 'temp'
deleteCert: true
- task: InstallAppleProvisioningProfile#1
inputs:
provisioningProfileLocation: 'secureFiles'
provProfileSecureFile: '$(oneSignalProvProfile)'
removeProfile: true
- task: InstallAppleProvisioningProfile#1
inputs:
provisioningProfileLocation: 'secureFiles'
provProfileSecureFile: '$(appProvProfile)'
removeProfile: true
- task: CocoaPods#0
inputs:
forceRepoUpdate: false
- task: DownloadSecureFile#1
inputs:
secureFile: $(provsPlist)
- task: Xcode#5
inputs:
actions: 'build'
xcWorkspacePath: '**/YOUR_WORKSPACE_NAME.xcworkspace'
scheme: 'YOUR_SCHEME_NAME'
packageApp: true
exportOptions: 'plist'
exportOptionsPlist: $(provsPlist)
signingOption: 'default'
- task: AppStoreRelease#1
inputs:
authType: 'UserAndPass'
username: 'YOUR_APPLE_ID_USERNAME'
password: 'YOUR_APPLE_ID_PASSWORD'
appIdentifier: 'YOUR_APP_IDENTIFIER'
appType: 'iOS'
ipaPath: '**/*.ipa'
releaseTrack: 'TestFlight'
shouldSkipSubmission: true
I saved the YAML file and ran the pipeline successfully. Incidentally, the last build task submits the build to TestFlight. I followed the advice here to create a separate apple ID with developer privileges and a complex password with 2-step verification advice to avoid token issues.
Hopefully this will help at least one person - or perhaps just me if I ever have the same problem in the future!

After upgrading to xcode 9, cordova app won't build, error 70, requires provisioning profile

Yesterday we upgraded from xcode 8.3.2 to version 9. And now our enterprise distribution apache cordova ios app refuses to build.
2017-09-21 07:37:16.787 xcodebuild[70400:217569] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/wj/yj3cfvh954gbc_btlhcrcx7nk7t4dj/T/App Name_2017-09-21_07-37-16.786.xcdistributionlogs'.
2017-09-21 07:37:16.938 xcodebuild[70400:217569] [MT] IDEDistribution: Step failed: <IDEDistributionSigningAssetsStep: 0x7ff756bbdf70>: Error Domain=IDEDistributionSigningAssetStepErrorDomain Code=0 "Locating signing assets failed." UserInfo={NSLocalizedDescription=Locating signing assets failed., IDEDistributionSigningAssetStepUnderlyingErrors=(
"Error Domain=IDEProvisioningErrorDomain Code=9 \"\"App Name.app\" requires a provisioning profile.\" UserInfo={NSLocalizedDescription=\"App Name.app\" requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the \"provisioningProfiles\" dictionary in your Export Options property list.}"
)}
error: exportArchive: "App Name.app" requires a provisioning profile.
Error Domain=IDEProvisioningErrorDomain Code=9 ""App Name.app" requires a provisioning profile." UserInfo={NSLocalizedDescription="App Name.app" requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the "provisioningProfiles" dictionary in your Export Options property list.}
** EXPORT FAILED **
Error: Error code 70 for command: xcodebuild with args: -exportArchive,-archivePath,App Name.xcarchive,-exportOptionsPlist,/Users/Shared/Workspace/github/AppName/platforms/ios/exportOptions.plist,-exportPath,/Users/Shared/Workspace/github/AppName/platforms/ios/build/device
(I replaced the apps name with "App Name" for this question)
I have verified that all the certs and provisioning profiles are set in xcode. And the build.json is set. I'm not really a Mac guy and I'm stumped on what to do next.
-Edit, Downgrading xcode to 8.3.3 fixed the problem. Not an ideal solution but not much I can do.
If you specify your provisioning profile explicitly, like me. Like this in your Cordova build.json:
"ios": {
"debug": {
"codeSignIdentitiy": "iPhone Developer",
"developmentTeam":"MYTEAMID",
"packageType": "developer",
"iCloudContainerEnvironment": "Development"
},
"release": {
"codeSignIdentitiy": "iPhone Distribution",
"developmentTeam":"MYTEAMID",
"provisioningProfile": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"packageType": "ad-hoc",
"iCloudContainerEnvironment": "Production"
}
}
Please Note
iCloudContainerEnvironment = Production/Development is only required if you use push notifications
You need to explicitly set manual signing and provide the provisioning keys in your ExportOptions.plist that is generated by Cordova. Unfortunately Cordova is not currently generating all of the required keys.
Here is what it needs to look like, at least for me:
<?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>compileBitcode</key>
<false/>
<key>method</key>
<string>ad-hoc</string>
<key>iCloudContainerEnvironment</key >
<string>Production</string>
<key>provisioningProfiles</key>
<dict>
<key>my.bundle.idenifier</key>
<string>My Provisioning Profile Name</string>
</dict>
<key>signingCertificate</key>
<string>iPhone Distribution</string>
<key>signingStyle</key>
<string>manual</string>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
<string>YOURTEAMID</string>
<key>thinning</key>
<string><none></string>
</dict>
</plist>
The file Cordova generates # cordova/app/platforms/ios/exportOptions.plist looks like:
<?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>compileBitcode</key>
<false/>
<key>method</key>
<string>development</string>
<key>teamID</key>
<string>MYTEAMID</string>
</dict>
</plist>
notice it is missing the important bits that Xcode 9 requires.
I generated the correct file by archiving the build manually, then exporting it which also creates the exportOptions.plist that I now use as reference.
After digging deeper, I found that this cannot be fixed after running "Cordova add platform iOS", because it is generated during the build phase dynamically. I decided to fork the Cordova-ios repo and submit a pull request. You may use my fork directly, or wait until the pull request is merged.
Pull Request
https://github.com/apache/cordova-ios/pull/338/commits
Fork
https://github.com/jrryhrtn/cordova-ios
Usage notes from pull request
See example below, please note that the provisioning profile can be the name or UUID of the profile. Name is preferred for maintenence, as UUID changes each time to regenerate the profile.
{
"ios": {
"debug": {
"codeSignIdentity": "iPhone Developer",
"developmentTeam":"YOURTEAMID",
"provisioningProfile": "provisioning profile name or UUID",
"packageType": "development"
},
"release": {
"codeSignIdentity": "iPhone Distribution",
"developmentTeam":"YOURTEAMID",
"provisioningProfile": "provisioning profile name or UUID",
"packageType": "ad-hoc"
}
}
}
I plan to manually patch until the/a fix is merged into the next Cordova release. You will have to regenerate your iOS platform after the patch via "Cordova platform rm iOS" and then "Cordova platform add ~/forks/cordova-ios". ~/forks/cordova-ios my local path, use the path on your local machine where you downloaded the forked Cordova-ios repo.
Update
cordova-ios 4.5.2 has been officially released! Upgrade by running the following commands: "cordova platform rm ios", and then "cordova platform add ios#4.5.2"
Cheers!
While help is coming and you don't want to use Xcode directly (and I don't judge you πŸ˜‰)... here is a temporary solution which worked fine for me:
remove ios
cordova platform rm ios
add ios from dev brunch where this issue already fixed.
(Later you will be able to use ios v4.6.0 or whatever final # is going to be)
cordova platform add https://github.com/apache/cordova-ios.git
I hope it will help you too! πŸ™‚
For who land of the following error
error: exportArchive: exportOptionsPlist error for key 'iCloudContainerEnvironment': expected one of {Development, Production}, but no value was provided
All you need to do it this to create a build
ionic cordova build ios --prod --release -- --iCloudContainerEnvironment=Production
More info:
https://medium.com/#michele.patrassi/https-medium-com-michele-patrassi-add-icloud-icloudcontainerenvironment-to-your-ionic-ios-app-227300bf8896

Resources