'xcodebuild -exportArchive: exportOptionsPlist error for key 'method': expected one of {}
I'm using command line xcodebuild tool to export ad-hoc distribution ipa file out of my archive like this:
xcodebuild -exportArchive -archivePath /path/Archive.xcarchive -exportPath /path -exportOptionsPlist /path/options.plist
However, this command fails with error
exportArchive: exportOptionsPlist error for key 'method': expected one of {}, but found ad-hoc
No mater what 'method' I provide in my export options plist, it always fails with this error. It also fails if I remove the 'method' option from the plist file.
Solution 1:[1]
I had this issue in one of my projects. After updating Cocoapods from 0.38.2 to 0.39.0 it was gone.
Also, I had a different related issue. Exporting was failing with the following error:
2015-10-22 17:16:12.568 xcodebuild[91172:2171408] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/_l/2rl169m16p717gzldvh7n0600000gq/T/MyDriveEU_2015-10-22_17-16-12.568.xcdistributionlogs'.
2015-10-22 17:16:12.860 xcodebuild[91172:2171408] [MT] IDEDistribution: Step failed: <IDEDistributionSigningAssetsStep: 0x7fbc13f0c970>: Error Domain=IDEDistributionErrorDomain Code=1 "The operation couldn’t be completed. (IDEDistributionErrorDomain error 1.)"
error: exportArchive: The operation couldn’t be completed. (IDEDistributionErrorDomain error 1.)
Error Domain=IDEDistributionErrorDomain Code=1 "The operation couldn’t be completed. (IDEDistributionErrorDomain error 1.)"
** EXPORT FAILED **
It turned out that xcodebuild didn't like teamID parameter I added to the exportOptions.plist. After I removed it, the app was exported successfully.
Solution 2:[2]
In my case one of my static libs did not have Skip Install enabled and this resulted in the same problem. When I set in xcode Skip Install to Yes for that project I fixed that problem.
Solution 3:[3]
I had the same issue since two days, The issue came from Apple certificates. Delete Apple Worldwide Developer Relations certification Authority from your keychain (would be expired at 14 Feb) and so renew it by download :
Solution 4:[4]
Check the following reasons:
- Your archive contains header files.
- Your archive contains static libraries or frameworks.
Solution 5:[5]
Pavel P's solution was
In my case one of my static libs did not have Skip Install enabled and this resulted in the same problem. When I set in xcode Skip Install to Yes for that project I fixed that problem.
Along the same vein, I was calling "xcodebuild" and passing in SKIP_INSTALL=NO as an option.
e.g.,
xcodebuild clean analyze archive -workspace MyWorkspace.xcworkspace -scheme MyScheme -configuration Debug SKIP_INSTALL=NO -archivePath /MyPath/MyArchive.xcarchive
Removing SKIP_INSTALL=NO in this case fixed my particular situation.
Solution 6:[6]
In my case the command was failing because the method key was missing or wrong. According to the man page of xcodebuild this is the list of allowed methods:
app-store, validation, ad-hoc, package, enterprise, development, developer-id, and mac-application
Note that the default value is "development". If you don't specify a method or you specify "developer-id", then you need to provide also a valid teamID key which is reported in the CN of the certificate provided by Apple which is used to sign the application (the teamID is a alphanumeric string at the end of the CN field).
In our case the Apple certificate was only installed in the build machine and no developer could have it installed on the personal computer or VM. So in order to test the package creation and signature we created a self-signed certificate using the steps reported here. Anyway since the teamID was not present in our certificate we had to set the method to "mac-application". In this case xcodebuild was not complaining and the package was generated correctly.
Our plist file was something 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>teamID</key>
<string>F4keTeamID0</string>
<key>compileBitcode</key>
<true/>
<key>method</key>
<string>mac-application</string>
</dict>
</plist>
Solution 7:[7]
Old thread but ran into this just today with Xcode 13.3 due to the .docarchive being added to the Products/Applications folder (both from Xcode and xcodebuild. In Xcode 13.2 and earlier, the documentation archive was not added to this folder so submissions and archive exports worked fine. As noted in tech note TN2215, there can only be a single product.
One workaround is just to turn off the Build Documentation during 'Build' setting in Build Settings. That worked for me.
Solution 8:[8]
I had the same issue and discovered when looking in KeyChain that the certificate used for signing had been revoked. Archiving worked fine but when we came to -exportArchive we got this cryptic error. HTH.
Solution 9:[9]
This forum helped me to fix the issue.
https://forums.developer.apple.com/message/59201#59201
SOLUTION: change the key from 'method' to 'export_method' in the exportOptionsPlist.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow


