Create an IPA using xCodeBuild

Xcode 5 brought a lot of improvements to the xCodeBuild command line tool. The most acclaimed by the developer community was that you finally can run your unit tests trough the command line using the Test build action.

Beside the Test action there was another big improvement: the new -exportArchive option. This new option allows to export archive to IPAs trough the command line and signed them with a designated profile. No more need of the xcrun PackageApplication.

Where before you did something like this:

xcrun -log -sdk iphoneos PackageApplication "$OUTPUTDIR/$APPNAME.app" -o "$OUTPUTDIR/$APPNAME.ipa" -sign "$DEVELOPER_NAME" -embed "$PROVISIONING_PROFILE"

You can now do this:

# First build the archive
xcodebuild archive -scheme $SCHEME_NAME -archivePath $ARCHIVE_NAME
# Then export it to an IPA
xcodebuild -exportArchive -archivePath $ARCHIVE_NAME.xcarchive -exportPath $ARCHIVE_NAME -exportFormat ipa -exportProvisioningProfile "$PROVISIONING_PROFILE" -exportSigningIdentity "$DEVELOPER_NAME"

The syntax is very similar to the PackageApplication command, you just need to create your archive first then export it to the IPA format. For Mac developers out there you can also export to the APP or PKG format.


Posted

in

by

Comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: