If I tried to export an .ipa
from an .xcarchive
using the command line using xcodebuild
as such:
xcodebuild archive -scheme "Cross" -archivePath "build/Cross.xcarchive"
xcodebuild -exportArchive -archivePath "build/Cross.xcarchive" -exportPath "build/Cross-tvOS.ipa"
it fails with the error "the platform is unknown: appletvos":
+ xcodebuild -exportArchive -archivePath build/Cross.xcarchive -exportFormat app -exportPath build/Cross-tvOS.ipa
--- xcodebuild: WARNING: -exportArchive without -exportOptionsPlist is deprecated
2015-11-30 22:13:44.403 xcodebuild[42874:30912505] [MT] DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-9081/IDEFoundation/Execution/Archiving/IDEArchivedApplication.m:148
Details: Asked if we support packaging as a given format, but the platform is unknown: appletvos
Object: <IDEArchivedApplication: 0x7f89bea3e990>
Method: -supportsPackagingAsFormat:
Thread: <NSThread: 0x7f89bbc320d0>{number = 1, name = main}
Please file a bug at http://bugreport.apple.com with this warning message and any useful information you can provide.
error: archive at path '/Users/pol/Downloads/Cross/tvOS/build/Cross.xcarchive' cannot be exported as APP
** EXPORT FAILED **
I can successfully export the .ipa
using the Xcode Organizer. This was observed on Xcode version 7.1.1.
It turns out the error message is misleading. This failure happens if you don't specify the -exportOptionsPlist
argument.
Even passing a fake empty .plist
file like this fixes the issue:
<?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/>
</plist>