Omnis Technical Note TNMC003 January 2011

iOS Wireless Application Distribution

By Jason Gissing
For Omnis Studio 5.1 and later.

As of iOS 4.0, Apple has introduced the ability for their iOS devices to receive and automatically install Ad-hoc apps Over The Air (OTA), from a standard web server, bypassing the need for your users to use a desktop computer and iTunes at all.

This allows a seamless and professional route for you to distribute your app to your users. You could easily set up a web page for your users to visit to download your apps, or you could send a link by email or SMS, which, when clicked, downloads and installs your app.

Create the remotely distributable application
Open your clientios xcode project, select the correct targets etc as you would for a normal build, then select Build and Archive from the Build menu.
Now open the Organizer from the Window menu, and under ARCHIVED APPLICATIONS you should see your app you just built. You may wish to give this archived build a name to identify it, as each time you Build and Archive, a new entry is added here.

Select the archive you wish to distribute, and press the Share button to open the following dialog:

The latest version of XCode embeds the provisioning profile in the app whenever you build a signed version. If it is not already signed, you can sign it here and embed your provisioning profile inside the app.

You can also update your archived build with a new provisioning profile by re-signing it here. You may have added more devices to the profile, or the original profile is about to expire, in which case, this saves doing a new build just to update the profile.

Press the Distribute for Enterprise button, and you will be presented with the following form:

• URL: This is the URL where the app is located on your server. It will be a .ipa file, so will be of the form: http://www.myserver.com/iOS_Apps/myApp.ipa

• Title: This is the name which will be used for the app until it is fully installed on the device, at which point it will revert to the name defined in your XCode project.

• Small Image: This is the URL to a 57x57 image on your server, which will display as the icon background while the app is being downloaded and installed on the device. Once it is installed, the app will display the icon which you defined in the XCode project.

The other fields can be ignored. You may wish to fill these in if you intend to parse the manifest file to retrieve the large image/subtitle when you build your web page, but they will not be seen by the user otherwise.

Press OK to open the save dialog. It is important that you save this as the same name you gave your .ipa file in the Application URL (e.g. myApp ). This will create a .plist (manifest) and .ipa (iOS app) file.

Setting up your server
Copy the .plist and .ipa file to your web server, in the location you specified in the Application URL above. If you’ve forgotten this, you can open the .plist, where you will be able to see how this was set.
If you defined an image, you should also make sure that this is copied to the appropriate location on your server.

Then you will use the following URL, which, when clicked on an iOS 4+ device, will download and install your app:

itms-services://?action=download-manifest&url= <URL to your plist file>

For example, here is a complete html link with the URL:

<a href =" itms-services://?action=download-manifest&url=http://www.myserver.com/iOS_Apps/myApp.plist "> Install My Application</ a >

Embedding this in a web page or email, and viewing on an iOS 4+ device should automatically download and install the app on the device.

If it does not, you may need to add .plist and .ipa as allowed mime types on your server.

Supplying Provisioning Profiles
If you wish, you can provide provisioning profiles as a separate download.
In the same way, copy your distribution provisioning profile to your server and you just need to provide a standard link to the file. For example:

<a href="http://www.myserver.com/iOS_Apps/distribution.mobileprovision"> Install My Provisioning Profile</a>

Installing/Updating from within your application
The ability to install apps Over The Air means that you can now update or install apps from within your Omnis iOS app.
All you need to do to begin the installation process is to execute the $showurl() method in your remote form, using the URL to your app’s manifest file as its argument. For example:

Do $cinst.$showurl("itms-services://?action=download-manifest&url=http://www.myserver.com/iOS_Apps/myApp.plist">)

If an app with an identifier which matches that of the app being downloaded already exists on the device, that app will be updated. If the app is updated, settings and saved preferences within the app will be preserved.