xcodebuild -exportArchive: exportOptionsPlist error for key 'method': expected one of {}
Solution 1
I suspected xcodebuild tool initially, but it turned out the archive file was invaid. When I opened the archive file in Xcode and tried to export an ipa file manually, I noticed that "Upload to App Store" and "Validate" buttons were disabled. After clicking the "Export" button, it gave me two options: "Save Built Products" and "Export as an Xcode Archive", but there was no Export ad-hoc distribution and the other regular options.
It turned out there were few library files along my .app file in the archive. Xcode considers this a generic archive and not an app archive. Check the Build Phases in your project settings for copying header and library files.
For more details, see https://developer.apple. com/library/ios/technotes/tn2215/_index.html
Solution 2
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 3
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 4
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 :
https://developer.apple.com/news/?id=02092016a
Solution 5
Check the following reasons:
- Your archive contains header files.
- Your archive contains static libraries or frameworks.
Vladimir Grigorov
Updated on July 09, 2022Comments
-
Vladimir Grigorov almost 2 years
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.
-
Kumar Garapati over 8 yearsYou really saved my day ..Thank you! .. Deleting teamID worked for me
-
Vladimir Grigorov about 8 yearsCheck if your Apple WWDR certificate has expired: reddit.com/r/iOSProgramming/comments/45siza/…
-
DawnSong about 8 yearsIf you installed Xcode 7.3 with El Capitan 10.11.4, you will find you have the renewed certificate. You can delete the expired one if you like, though you have no need to delete it.
-
dbernard almost 8 years+1! In my case both a static library and a Common bundle were not "Skipping Install", which caused the issue.
-
Rob Keniger over 7 yearsI forgot that I had a sub-project in my project that was building a library. Removing the public header and setting "skip install" to true for the library in that sub-project's target worked for me.
-
Nate Rickard over 6 yearsI hit this when I had a scheme that was (accidentally) set to build multiple targets. My CI was set to build this scheme and failed in the export step, I assume because it had > 1 thing in the archive as you describe. Thanks!
-
xxcv almost 4 yearsAs it was suggested in post below stackoverflow.com/a/49790922/443279. I've open archive and found that there was one of our frameworks that has "skip install" set to NO
-
Frederik almost 4 yearsFor me the invalid archive was caused by a missing "ApplicationProperties" entry in the Info.plist file inside the .xcarchive. Rebuilding seems to now have created a valid archive. The invalid archive was also apparent by its missing app icon in the Finder (it had a generic archive icon instead).
-
Motti Shneor over 3 yearsI tried it, and it didn't work - it looks like "export_method" isn't at all a supported key in exportOptionsPlist (see xcodebuild -help | grep exportOptionsPlist). I keep receiving the same error for the "method", only now when there's no 'method' key in my .plist, it complains about the default (which is 'development') instead of the real value ('developer-id') I was using. this answer isn't correct.
-
Motti Shneor over 3 yearsInteresting. Did you manage to get it to work once you introduced a viable certificate into your key-chain? Your answer is actually "don't believe the error message - the problem may be different"
-
Motti Shneor over 3 yearsI never introduced my teamID, still this error is biting my leg :(
-
Carla Camargo over 3 yearsThis also fixed my problem. The only special thing on my project was a .xcframework for device and simulator, MSAL.
-
marika.daboja about 3 yearsThank you for this answer - it saved my day! I have had same issue (multiply git branches within same project) and Archive from Xcode was showing SUCCESS however Export was showing only 2 options ("Save Built Products" and "Export as an Xcode Archive") plus Fastlane was returning same error. I have changed Target -> Build Settings -> Deployment -> Skip Install to 'No' and it fixed my problem.
-
Reuben Scratton almost 3 yearsThanks for this! I too had a framework that was ending up in the xcarchive... setting that framework's "Skip install" to YES for all configs fixed it. Suspect I would never have figured it out without this post.
-
IvanPavliuk over 2 yearsWorks for me if set
Skip Install
toNo
-
Umur Gedik almost 2 years@Frederik thank you so much! After I disabled Info.plist generation I was missing a few properties, thanks to you I found what I missing.