ios - not - xcodebuild archive




Errors converting xcarchive to IPA-single-bundle archive+missing plist method values (5)

Apple got back to me with a solution. As of Xcode 7 we should use xcodebuild instead of PackageApplication to produce the .ipa file.

xcodebuild has a new -exportArchive option to create an .ipa that works more like Xcode Organizer.

So we should now:

  1. build an archive with xcodebuild archive

  2. create the .ipa with xcodebuild -exportArchive

We now build the archive like this:

xcodebuild -workspace myApp.xcworkspace -scheme myApp -sdk iphoneos -configuration AppStoreDistribution archive -archivePath $PWD/build/myApp.xcarchive

We now export the .ipa like this:

xcodebuild -exportArchive -archivePath $PWD/build/myApp.xcarchive -exportOptionsPlist exportOptions.plist -exportPath $PWD/build

These two command create the files build/myApp.xcarchive and build/myApp.ipa

Note that xcodebuild -exportArchive requires a -exportOptionsPlist argument that points to a .plist file with export options. For a complete list of what you can put in that plist, run xcodebuild -help. The minimal contents of the file looks 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>method</key>
    <string>app-store</string>
    <key>teamID</key>
    <string>YOUR_TEN_CHARACTER_TEAM_ID</string>
</dict>
</plist>

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.


I got some similar strange errors from XCode 7.2 when building for the simulator on the command line. You could try to either add -sdk iphoneos to your xcodebuild command (in order to skip simulator builds), or add something like -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' if you're building for the simulator.


Since the way you are creating an IPA is deprecated, you should do the following instead:

xcodebuild -scheme "Foo" -configuration Release clean build CODE_SIGN_IDENTITY="iPhone Distribution: Foo Corporation" -derivedDataPath "/path/to/some/folder/"

xcrun -sdk iphoneos PackageApplication "/path/to/some/folder/Build/Products/Release-iphoneos/foo.app" -o "/path/to/some/folder/foo.ipa"

Make sure you replace "Foo" with your schema name, and "iPhone Distribution: Foo Corporation" with your signing identity. And "/path/to/some/folder/" should be some build folder.


The archive at path foo.xcarchive is not a single-bundle archive.

About this error:

  1. check edit scheme -> Build
  2. untick other targets, including Analyze, Test, Run, Profile, Archive
  3. xcodebuild the archive
  4. export the archive again

Try using absolute paths as parameters to xcodebuild options rather than relative paths.

So something like this:

xcodebuild -exportArchive -archivePath "$PWD/foo.xcarchive" \
-exportPath "$PWD" -exportOptionsPlist "$PWD/ipa.plist"

As long as your .xcarchive is intact and signed correctly, that should work. This is what I'm using in my build system.