Our iOS build server happily created IPA files until we upgraded to Xcode 8.3. Now, instead of delivering our applications, our server complains:
xcrun: error: unable to find utility "PackageApplication", not a developer tool or in PATH
And that's how a ten-minute Xcode upgrade became a several-hour project. On Xcode 8.2 and earlier, we used PackageApplication to generate an IPA file from an xcarchive:
xcrun -sdk iphoneos PackageApplication "$ARCHIVE_PATH/Products/Applications/$PRODUCT_NAME.app\" -o "somePath/buildName.ipa"
The command was simple. It took the app file in the xcarchive as input, and it created an IPA file named exactly as the -o flag indicated. Too bad they deprecated and removed it!
My research indicated that the replacement command was xcodebuild -exportArchive, but the documentation didn't explain very much. Let me save you a lot of work. The new command looks like this:
xcodebuild -exportArchive -archivePath "$ARCHIVE_PATH" -exportPath "somePath" -exportOptionsPlist "$SRC_ROOT/aNewPlist.plist"
The argument to -archivePath is the path to the xcarchive, not to the .app file inside of it. If you accidentally specify the path to the .app file, you'll get this cryptic message:
error: exportArchive: exportOptionsPlist error for key 'method': expected one of {}, but found enterprise
The -exportPath is a directory where you want the IPA file to be saved -- you no longer can control the name of the exported IPA file. Luckily, you can provide a path that ends in a directory that doesn't exist yet -- -exportArchive will create that new directory for you and deposit the IPA file inside of it.
The -exportOptionsPlist is a new input! You must supply a path to a plist file which describes some options for the export. You can use xcodebuild -help to see how to configure the plist file. As far as I can tell, the method key is the most important item to have. You can find example plists for -exportOptionsPlist online. Xcode can help you create and edit the plist file.
Good luck, and I hope this helps!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment