Mindaugas
Mindaugas

Reputation: 1173

build .ipa from terminal issue with provisioning profile

I run this script at first:

xcodebuild clean archive -archivePath archive/MyApp -scheme MyAppScheme

It passes and generates MyApp.xcarchive in archive directory. Then I try to generate .ipa file from the archive and fun starts there. I run this script:

xcodebuild -exportArchive -exportFormat ipa -archivePath "archive/MyApp.xcarchive" -exportPath "build/MyApp.ipa" -exportProvisioningProfile "UUID from file in ~/Library/MobileDevice/ProvisioningProfiles"

This script fails with: error: no provisioning profile matches 'XXXXXXX-XXX-XXX...'

If I try this build script istead of previous to build .ipa:

xcodebuild -exportArchive -exportFormat ipa -archivePath "archive/MyApp.xcarchive" -exportPath "build/MyApp.ipa" PROVISIONING_PROFILE=Same UUID from file in ~/Library/MobileDevice/ProvisioningProfiles

It passes and generates .ipa, but when submiting .ipa file via Application Loader I get the error that provisioning profile is invalid:

ERROR ITMS-90161: "Invalid Provisioning Profile. The provisioning profile included in the bundle com.myapp [Payload/MyApp.app] is invalid. [Missing code-signing certificate]. A Distribution Provisioning profile should be used when submitting apps to the App Store. For more information, visit the iOS Developer Portal."

I am sure that provisioning profile UUID I use is Distribution one, because when I open file with text editor I can find this:

<key>aps-environment</key>
<string>production</string>

What I managed to find out is that second script that passes uses another Provisioning UUID (there is 3 of them in the directory: personal one and two for for app from apple developers site - one development, another production). I found out this by following steps from here: How to tell what profile/signing certificate was used to sign .ipa? and checking UUID in .ipa files, both - generated via the second script that passes and generated via xcode(xcode passes the UUID I pass to terminal script).

So I assume the terminal script that builds .ipa(the second one) ignores inserted provisioning profile part of run script and simply grabs the first one from provisioning profiles directory.

Any suggestions how to fix the script that says: error: no provisioning profile matches 'XXXXXXX-XXX-XXX...' ???

Upvotes: 2

Views: 1359

Answers (1)

Mindaugas
Mindaugas

Reputation: 1173

The answer was here: xcodebuild error: no provisioning profile matches (the one marked as correct). It is bit confusing. Basically, it doesn't matter what UUID or provisioning file name is in your machine locally. You need to go to https://developer.apple.com/account/ios/profile/production and copy what is next to name label(copy the name).

enter image description here

Or you can find ir under name tag in the file in the provisioning files directory on your machine.

Upvotes: 1

Related Questions