Commit #2 : Export your *.xcarchive to *.ipa via terminal!

December last year, several Ice House clients asked for Christmas update on their app. There’s a strange case that occurred when our team tried to send old projects to the iTunesConnect using Xcode 6’s Organizer, just like this image :

Screen Shot 2015-01-09 at 17.12.22

Our supervisor, Didiet, said this issue might be caused by the project file. The project was built on Xcode 5.1 and we’re trying  to publish it from Xcode 6. Since we don’t have much time left, we ended up using xcodebuild‘s exportArchive command from terminal to export the *.xcarchive from Organizer to *.ipa :

xcodebuild -exportArchive -archivePath [*.xcarchive path] -exportPath [*.ipa output path] -exportProvisioningProfile [provisioning profile name]

To retrieve the *.xcarchive’s path, we opened the Organizer, right-clicked the wished archive, and selected “show in Finder” menu. After the *.ipa extracted, we send it to iTunesConnect using Xcode’s Application Loader – successfully!  It was Friday night, and xcodebuild saved our weekend! 😀

I still found the same issue on several old projects, and didn’t found how to fix it – so I ended up using that xcodebuild command to send new builds to App Store. Tired of typing the long command over and over again, I made this script to make the process easier :

helptext="Usage: `basename $0` [*.xcarchive path] [*.ipa export path] [provisioning profile name]"
if [ "$1" == "-h" ] || [ "$1" == "–help" ]; then
echo $helptext
exit 0
if [ "$#" -ne 3 ]; then
echo "Illegal number of parameters. $helptext"
exit 0
xcodebuild -exportArchive -archivePath "$archivepath" -exportPath "$exportpath" -exportProvisioningProfile "$provisioningprofile"

To make it accessible from everywhere, I put that script on my /usr/local/bin directory. Now, exporting new *.ipa is as easy as writing xcodebuild_export_xcarchive and it’s parameters on my iTerm. 🙂

Thank you for reading! 🙂



Leave a Comment

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

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

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s