问题
I'm trying to build and archive my XCode project using following command:
xcodebuild -scheme MyApp -workspace MyApp.xcworkspace clean archive -archivePath build/MyApp
xcodebuild -configuration AdHoc -exportArchive -exportFormat ipa -archivePath "build/MyApp.xcarchive" -exportPath "build/MyApp.ipa" -exportProvisioningProfile "afe33cd1-5e6c-47a6-a315-bd442e43ad95"
It is building successfully but exporting ipa is failling with following error:
error: no provisioning profile matches 'afe33cd1-5e6c-47a6-a315-bd442e43ad95'
** EXPORT FAILED **
I have tried following as well
-exportProvisioningProfile "afe33cd1-5e6c-47a6-a315-bd442e43ad95.mobileprovision"
I'll appreciate any help in this regard. Thanks
回答1:
Value of -exportProvisioningProfile should be the exact name of the provision profile in your system, you can copy this exact name from your developer portal also.
回答2:
Here is how you can fix this:
Step 1)
Find the provisioning profile name:
/usr/libexec/PlistBuddy -c 'Print Name' /dev/stdin <<< $(security cms
-D -i {placeholder})
Replace the {{placeholder}} with absolute path of provisioning profile with profile name.
Example:
/Users/abc/Library/MobileDevice/Provisioning\ Profiles/49a23630-f766-4892-90f0-d9were00f2fc.mobileprovision)
Step 2)
Build ipa from app file
get the provisioning profile name and replace below {profileName}
replace {archiveFile} with the absolute path of .xcarchive file
replace {pathtosaveipa} with path where you want to save ipa
replace {codesigningName} with the certificate name associated with provisioning profile
execute below after replacing the placeholder with actual value
xcodebuild -exportProvisioningProfile "{profileName}" -exportArchive -exportFormat IPA -archivePath "{archiveFile}" -exportPath "{pathtosaveipa}/app.ipa" CODE_SIGN_IDENTITY="{codesigningName}"
来源:https://stackoverflow.com/questions/37263352/xcodebuild-error-no-provisioning-profile-matches