I'm trying to convert my xcarchive to an IPA (XCode 7.1.1). The following command
xcodebuild
-exportArchive -archivePath foo.xcarchive -exportPath . -exportFormat IPA
Fails with the error
the archive at path 'foo.xcarchive' is not a single-bundle archive
Since the above command is technically deprecated, I also tried the new form:
xcodebuild
-exportArchive -archivePath foo.xcarchive -exportPath .
-exportOptionsPlist ipa.plist
Where the ipa.plist is as follows:
<?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>method</key>
<string>app-store</string>
</dict>
</plist>
Which then resulted in the error:
error: exportArchive: exportOptionsPlist error for key 'method': expected one of {}, but found app-store
Now, trying to debug this I opened the xcarchive folder and inspected its structure. I noticed that I have a folder on the same level as Products\Applications\foo.app so I deleted it and tried again to no avail (same results). I then proceeded to delete files from within foo.app until I remained with nothing but the DWARF binary - still no cigar (same result), though that could have been due to the fact that I messed up the app signature by deleting files manually.
The problem was that one of our post-build steps left a stray folder in the
TARGET_BUILD_DIR. This caused the generatedxcarchiveto be formatted as the dreaded generic archive. My attempts to delete the folder after the fact from thexcarchiveitself were doomed to fail since thexcarchivehas been flagged generic at the moment of its creation (as evidenced by some missingInfo.plistfields). Once I made sureTARGET_BUILD_DIRcontained only the.appafter all the build phases were said and done, the generatedxcarchivewas formatted properly as an iOS app archive. Thatxcarchive, in turn, was easily exported to a proper IPA viaxcodebuild -exportArchive -exportPlistOptions, which is the officially supported Apple recommendation that takes care of all the problematic SWIFT support folders and the like.