Rapture In Venice, LLC

:: Mobile Apps for iPhone, iPad, AppleTV and Watch

IPA Targets for iPhone — Why and How?

Admittedly, one of the most annoying parts of building iPhone apps for clients is merely giving them the app to install. The usual case is that you hand them a *.app directory that, to a Mac user, looks like a file, but to a client using Windows it’s a directory. And when Windows users open this directory, files tend to be added by Windows Explorer. This wouldn’t be so bad except that the content changes rewrite the hash signature and users then have trouble installing your iPhone Ad Hoc builds.

It’s gotten so bad that the first thing I tell clients when they have trouble is to “re-download the build and DO NOT OPEN THE FOLDER.” 9 times out of 10 this fixes the problem, but it doesn’t have to be this way.

What is an IPA?

Enter IPA’s. The best that I can tell, an IPA is just Apple’s internal way of bundling apps together. Luckily, we can do it, too! What is an IPA? It’s a file. YES. A file. A real one. What this means is that your clients (and heck, even some of your fellow developers!) can’t mess it up. :-)

Setting Up an IPA Build Target

Simple! All you need to do is set up a new build target. I call mine IPA, but you can call it whatever you want. Here’s the process:

  1. Create a new build target, of type “Other/Aggregate” (see the Mac OS X section)
  2. Add the build targets you want to build IPA’s for as direct dependents. This means they will get built before the IPA target is built.
  3. Add a new Run Script Build Phase to the IPA target.
  4. Now cut and paste the following code:
    APPS="MyAppName"
    
    cd $CONFIGURATION_BUILD_DIR
    
    for i in $APPS
    do
    	echo Creating IPA for $i.app
    	mkdir -p Payload
    	cp -R $i.app Payload 
    	cp $SRCROOT/Resources/itunes-icon.png $CONFIGURATION_BUILD_DIR/iTunesArtwork
    	zip -qr $i.ipa Payload iTunesArtwork
    	rm -rf Payload
    	rm iTunesArtwork
    done
    
    

    The only things you need to change in the above is MyAppName and whatever your iTunes artwork is called (the 512×512 version). The artwork isn’t vital, but it appears in your iTunes library when you install and it’s ugly not to see an icon.

    Replace MyAppName with whatever your *.app name is. The best way to figure this out is to double click your app’s regular target, click the Build Tab, and find the value for “Product Name”.

    Now, to build the IPA just set your Active Target to IPA, use whatever build configuration you want, and you’re good to go!

    • Print
    • Facebook
    • Twitter

    John Blanco

    John Blanco is a freelance iOS developer in Denver, CO. He's been developing mobile apps for 12 years, starting during the medieval days of Java ME, making him the ultimate hipster mobile engineer. Follow him on Twitter!

    More Posts

    Follow Me:
    Twitter

    ,

    Comments are currently closed.

roma rehberi