Simplifying wireless iPhone app distribution with PHP

February 7th, 2011 § 6 comments § permalink

iOS 4.0 came with the ability to distribute your ad hoc apps over the air, which is very convenient for testers. More details are available on Apple’s website. Unfortunately, doing this manually can be a bit of a hassle, partly because the everything in the XML manifest requires absolute URLs.

I’ve created a PHP script that makes this task somewhat easier.

Requirements:
A web server that runs PHP 5 with the following extensions:

  • ZIP
  • either MBString or Iconv
  • either BC or GMP or phpseclib

Installation/usage:

  1. Download and unzip the files into a new directory on your web server.
  2. Create a directory for each app you want to deploy (the directory cannot have any spaces in its name!).
  3. In this directory, put:
    • the .IPA file of your app, built using Xcode’s “Build & Archive” command (no spaces in the filename)
    • the .mobileprovision file (again, no spaces in the filename)
    • a 512×512 PNG file named iTunesArtwork.png (case-sensitive)
    • a 72×72 PNG file named Icon.png (case-sensitive)

    The directory structure should look like this:
    Directory layout for wireless app distribution PHP script

  4. Now visit the web page that corresponds to the directory where you unzipped the files. You should see something like this:

    with one entry for each directory.
  5. Visit the same page on an iOS device running iOS 4.0 or higher. You should be able to install the app simply by tapping on the corresponding “app” link. You shouldn’t need to install the provisioning profile separately, but if you do, it can also be installed via the web site by tapping on the “provisioning profile” link.

That’s it. I admit the code is a bit of a mess, as it was hacked together relatively quickly. I haven’t been able to get it working when there are spaces in the names of the files or directories. Perhaps someone else can fix that :)

This code uses the very useful CFPropertyList PHP library by Rodney Rehm to parse the Info.plist file that’s in the IPA, to extract all the info required by the XML manifest. That’s how the magic happens.

Download the files here.

Where Am I?

You are currently browsing entries tagged with ios 4 at bunnyhero dev.