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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With