Search code examples
command-linexcode8ipaxcodebuild

Command line create Ad Hoc .ipa issue


Since updating to Xcode 8.3, I've found that XCRun PackageApplication is deprecated and I've been trying to switch over to using xcodebuild exportArchive. I've seem quite a few posts about problems doing this but still haven't managed to get this working myself.

My test call is:

xcodebuild -exportArchive IPA -archivePath test.xcarchive/Products/Applications/test.app -exportPath . -exportOptionsPlist a.plist

My xcarchive seems to be fine as I can package it for Ad Hoc distribution manually in Xcode.

My plist is:

<?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>uploadSymbols</key>
<false/>
<key>uploadBitcode</key>
<false/>
<key>method</key>
<string>ad-hoc</string>
<key>compileBitcode</key>
<false/>
</dict>
</plist>

But I get this error:

error: exportArchive: exportOptionsPlist error for key 'method': expected one of {}, but found Error Domain=IDEFoundationErrorDomain Code=1 "exportOptionsPlist error for key 'method': expected one of {}, but found " UserInfo={NSLocalizedDescription=exportOptionsPlist error for key 'method': expected one of {}, but found }

I've also been trying to use fast lane gym. With that, I can create a .ipa on the command line but I need to specify a provisioning profile to use as it's not being signed with the correct one for testers.

If you need any more information, please let me know.

Thanks, Chris.


Solution

  • Your value for the -archivePath param is not correct, please try just to reference the xcarchive. You can also omit the IPA string after -exportArchive, as it has no effect:

    xcodebuild -exportArchive -archivePath test.xcarchive -exportPath . -exportOptionsPlist a.plist
    

    The xcarchive contains a Info.plist, which specifies where the app bundle can be located inside the xcarchive, so you don't need to specify this yourself.

    See man xcodebuild for details