azure-flutter-tasks
azure-flutter-tasks copied to clipboard
Build iOS IPA: error: exportArchive: "Runner.app" requires a provisioning profile
Hey,
i have the following problem and it drives me crazy.
[ +2 ms] Building App Store IPA...
[ ] executing: xcrun xcodebuild -exportArchive -allowProvisioningDeviceRegistration -allowProvisioningUpdates -archivePath /Users/runner/work/1/s/build/ios/archive/Runner.xcarchive -exportPath /Users/runner/work/1/s/build/ios/ipa -exportOptionsPlist /Users/runner/work/1/s/ios/ExportOptions.plist
[+1725 ms] ** EXPORT FAILED **
2024-09-21 11:44:03.433 xcodebuild[18190:81657] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path "/var/folders/jq/0ryt2n7x2h9_f002rzt_hjj00000gn/T/Runner_2024-09-21_11-44-03.432.xcdistributionlogs".
error: exportArchive: "Runner.app" requires a provisioning profile.
Error Domain=IDEProvisioningErrorDomain Code=9 ""Runner.app" requires a provisioning profile." UserInfo={IDEDistributionIssueSeverity=3, NSLocalizedDescription="Runner.app" requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the "provisioningProfiles" dictionary in your Export Options property list.}
[ +2 ms] Building App Store IPA... (completed in 1,726ms)
[ +2 ms] Encountered error while creating the IPA:
[ +1 ms] error: exportArchive: "Runner.app" requires a provisioning profile.
[ ] Try distributing the app in Xcode: "open /Users/runner/work/1/s/build/ios/archive/Runner.xcarchive"
[ ] "flutter ipa" took 230,014ms.
I am using the following task configuration:
- task: FlutterBuild@0 displayName: "Build application" inputs: target: 'ipa' projectDirectory: '$(Build.SourcesDirectory)' verboseMode: true buildNumber: '$(Build.BuildNumber)' exportOptionsPlist: '$(Build.SourcesDirectory)/ios/ExportOptions.plist'
I am installing my Apple Certificate and provisioning profile correctly. I am using the latest flutter version as well as the macos-latest runner image.
What is wrong here? My provisioning profile is set up correctly.
Hi, It seems like it isn't able to find the provisioning profile. Please go through the WIKI section here on this repo and this issue
I ended up using the following:
- stage: iOSStage
pool:
vmImage: macos-14
displayName: iOS
dependsOn: []
jobs:
- job: iOSJob
displayName: iOS
steps:
- task: CmdLine@2
displayName: 'Select Xcode version'
inputs:
script: |
echo Mac OS version:
sw_vers -productVersion
echo
echo Installed Xcode versions:
ls /Applications | grep 'Xcode'
echo
echo currently selected xcode:
xcrun xcode-select --print-path
echo
echo selecting latest xcode...
sudo xcode-select -s /Applications/Xcode_16.app
xcrun xcode-select --print-path
xcodebuild -version
failOnStderr: true
- task: InstallAppleCertificate@2
displayName: Install Apple certificate
inputs:
certSecureFile: 'CertStore.p12'
certPwd: '$(iOSCertificatePassword)'
keychain: 'temp'
- task: InstallAppleProvisioningProfile@1
displayName: Install provisioning file
inputs:
provisioningProfileLocation: 'secureFiles'
provProfileSecureFile: 'Profile.mobileprovision'
- task: FlutterInstall@0
displayName: "Install Flutter SDK"
inputs:
mode: 'auto'
channel: 'stable'
version: 'latest'
# - task: FlutterCommand@0
# displayName: "Run Flutter diagnostics"
# inputs:
# projectDirectory: '.'
# arguments: 'doctor -v'
- task: FlutterBuild@0
displayName: "Build Flutter application"
inputs:
target: 'ios'
projectDirectory: '$(Build.SourcesDirectory)'
buildNumber: '$(Build.BuildNumber)'
iosCodesign: false
- task: Xcode@5
displayName: Archive application
inputs:
actions: 'archive'
configuration: 'Release'
sdk: 'iphoneos'
xcWorkspacePath: '**/Runner.xcworkspace'
scheme: 'Runner'
packageApp: true
exportPath: '$(Build.SourcesDirectory)/build/ios/iphoneos'
exportOptions: 'plist'
exportOptionsPlist: '$(Build.SourcesDirectory)/ios/ExportOptions.plist'
signingOption: 'manual'
signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)' # From "Install Apple Certificate"
provisioningProfileUuid: '$(APPLE_PROV_PROFILE_UUID)' # From "Install provisioning profile"
- task: CopyFiles@2
displayName: "Copy app to staging directory"
inputs:
sourceFolder: '$(Agent.BuildDirectory)'
contents: '$(Build.SourcesDirectory)/build/ios/iphoneos/*.ipa'
targetFolder: '$(Build.StagingDirectory)'
flattenFolders: true
- task: CopyFiles@2
displayName: "Copy releasenotes to staging directory"
inputs:
sourceFolder: '$(Agent.BuildDirectory)'
contents: '$(Build.SourcesDirectory)/releasenotes.txt'
targetFolder: '$(Build.StagingDirectory)'
flattenFolders: true
- task: PublishBuildArtifacts@1
displayName: "Publish artifacts"
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'App.iOS'
publishLocation: 'Container'