xcodebuild -exportArchive rejects the method key in exportOptions.plist
error: exportOptionsPlist error for key 'method': expected one of {}Short answer
xcodebuild accepts only the method values that fit the archive type. Use app-store-connect, release-testing, enterprise or debugging instead of the deprecated app-store, ad-hoc and development. If the list of allowed values is empty, the archive holds no exportable app, so check the build and archive steps.
Fix it fast
1Find out which cause you have
Print the options xcodebuild documents for the export plist, then read the method line. Compare it with the value in your plist.
xcodebuild -help | grep -A 3 "method : String" /usr/libexec/PlistBuddy -c "Print :method" exportOptions.plist2Match what you see, then jump to its fix
- 1
The plist uses app-store, ad-hoc or development, a typo, or a value for another platformThe method value is not one xcodebuild accepts for this archiveFix - 2
expected one of {} with an empty setThe archive has no app inside, so no method is validFix - 3
The path is a build folder, a missing file or an older archive-archivePath points at something the archive action did not produceFix
- 1
What does the error look like?
error: exportOptionsPlist error for key 'method': expected one of {}xcodebuild: error: exportArchive: exportOptionsPlist error for key
Cause 1 of 3
The method value is not one xcodebuild accepts for this archive
1Check
xcodebuild -help lists the valid values: app-store-connect, release-testing, enterprise, debugging, developer-id, mac-application and validation. The list depends on the archive type. app-store, ad-hoc and development are marked deprecated there.
/usr/libexec/PlistBuddy -c "Print :method" exportOptions.plist2Fix
Set the current name that matches your goal: app-store-connect for the store or TestFlight, release-testing for ad hoc builds, debugging for development builds.
/usr/libexec/PlistBuddy -c "Set :method app-store-connect" exportOptions.plist3Verify
Run the export again.
xcodebuild -exportArchive -archivePath MyApp.xcarchive \
-exportPath build/export -exportOptionsPlist exportOptions.plistConfirmed by developer.apple.com
Cause 2 of 3
The archive has no app inside, so no method is valid
1Check
The valid list varies with the archive type. An app target with Skip Install set to YES is not installed into the archive, so the archive has nothing to export.
xcodebuild -showBuildSettings -scheme MyApp | grep SKIP_INSTALL2Fix
Set Skip Install to NO on the app target for the Release configuration (Skip Install is YES only for helper targets such as embedded frameworks), then archive again.
xcodebuild archive -scheme MyApp -configuration Release -archivePath MyApp.xcarchive3Verify
Export the new archive.
xcodebuild -exportArchive -archivePath MyApp.xcarchive \
-exportPath build/export -exportOptionsPlist exportOptions.plistConfirmed by developer.apple.com
Cause 3 of 3
-archivePath points at something the archive action did not produce
1Check
The man page says -archivePath is the archive produced by the archive action, or the archive to export. A normal build does not create one.
ls -d MyApp.xcarchive
man xcodebuild | col -b | grep -n -A 3 "archivePath xcarchivepath"2Fix
Create the archive with the archive action first, then pass that same path to -exportArchive.
xcodebuild archive -workspace MyApp.xcworkspace -scheme MyApp \
-archivePath MyApp.xcarchive3Verify
The export step runs against the new archive.
xcodebuild -exportArchive -archivePath MyApp.xcarchive \
-exportPath build/export -exportOptionsPlist exportOptions.plistConfirmed by developer.apple.com
How do I stop it coming back?
- Keep exportOptions.plist in the repository next to the CI script, and update method when you update Xcode.
- Print xcodebuild -help in CI logs so a changed list of values is visible.
- Run archive and exportArchive as two steps against one explicit archive path.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Related fixes
Mobile apps
Cannot change the App Privacy answers in App Store Connect
Publish Your App Privacy Responses?
Only the Account Holder, Admin and App Manager roles can answer the App Privacy questions.
2 causes, each with a fixMobile apps
App record creation fails because you lack permission
You cannot add a new app in App Store Connect as a Developer or limited user
Only the Account Holder, an Admin or an App Manager can create an app record, and Apple blocks it until the Account Holder has signed the latest agreement.
3 causes, each with a fixMobile apps
You cannot find the button to pull your app back from review
No 'remove this version from review' message appears on the version page
There is no button called Reject Binary.
3 causes, each with a fixMobile apps
Your Apple Account cannot sign in to App Store Connect
Sign-in to App Store Connect is refused for an account that should have access
App Store Connect does not open to every Apple Account.
3 causes, each with a fixMobile apps
Apple rejected the app under Guideline 4.3, Design: Spam
Guideline 4.3(b) - Design - Spam
Guideline 4.3 is Apple's duplicate rule.
5 causes, each with a fixMobile apps
App Store Connect rejects a screenshot because it has transparency
Images can't include alpha channels or transparencies.
App Store Connect does not accept screenshots that carry an alpha channel or transparent pixels.
2 causes, each with a fix