Xcodebuild: Creating .ipa using -exportarchive always fails to find provisioning profile?
Asked Answered
S

1

6

Trying to create ipa from archive running the following command:

xcodebuild -exportArchive -archivePath $PWD/archive/test.xcarchive -exportOptionsPlist exportOptions.plist -exportPath $PWD/build

Always throws an error as follows though I have the profile installed:

error: exportArchive: No "iOS Ad Hoc" profiles for team 'XXXXXXXXXX' matching 'adhoc_profile' are installed.

Error Domain=IDEProfileLocatorErrorDomain Code=4 "No "iOS Ad Hoc" profiles for team 'XXXXXXXXXX' matching 'adhoc_profile' are installed." UserInfo={NSLocalizedDescription=No "iOS Ad Hoc" profiles for team 'XXXXXXXXXX' matching 'adhoc_profile' are installed., NSLocalizedRecoverySuggestion=Install a profile (by dragging and dropping it onto Xcode's dock item) or specify a different profile in your Export Options property list.}

Update: exportOptions.plist as follow

<?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>ad-hoc</string>      
<key>provisioningProfiles</key>     
<dict>       
<key>com.app.appname</key>      
<string>adhoc_profile</string>  </dict>      
<key>signingStyle</key>     
<string>manual</string>      
<key>stripSwiftSymbols</key>    
<true/>     
<key>teamID</key>    
<string>XXXXXXXXXX</string>     
<key>thinning</key>      
<string>&lt;none&gt;</string> 
</dict> 
</plist>
Savarin answered 6/2, 2019 at 6:50 Comment(6)
Are you sure you've created an Ad Hoc provisioning profile and not an App Store one?Jacki
Yes I am pretty sure, I am able to archive and distribute using Xcode, but doing so using xcodebuild on terminal always fails to find provisioning profileSavarin
Can you post a screenshot of your exportOptionsPlist and also the details of your provisioning profile?Jacki
Updated the post with exportOptions.plist, let me know if there is anything else. ThanksSavarin
Everything looks alright to me. Only other thing I can think of is there may be a mismatch with how the Profile has been set up on the Developer Portal. Another thing to try would be making sure you have the up to date build tools installed.Jacki
Note that xcodebuild looks for provisioning profiles in Library/MobileDevice/Provisioning Profiles/*******.mobileprovisionMusketeer
M
0

Try to check provisioning profile name at developer.apple.com. Are there whitespaces in the name? If so then you should pass it to provisioningProfiles of export options exactly like specified there, i.e. with whitespaces in the name even if the downloaded file name of provisioning profile is without whitespaces, e.g. adhoc_profile.mobileprovision

screenshot from developer.apple.com - generate new provisioning profile

Mirador answered 24/10, 2023 at 13:56 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.