Part 1 listed the steps required to create a mobile provisioning profile for your app. This part describes the steps required to create the application file (.IPA) and how to set up your webserver to host the distribution of the app.

There are 2 sections in the project options of your Delphi project that must be filled out in order for your app to be distributed ad-hoc. Firstly, let’s look at the Version info:

The CFBundleName and CFBundleIdentifier are the key fields here that need to be filled out, and CFBundleIdentifier must equal the application ID that you generated at the developer portal. In the Provisioning section, select All Configurations – iOS Device Platform. It won’t matter whether your app is a debug or release build, you’ll still need the same information here. Select a Build Type of iOS Device – Ad Hoc. You’ll note the items below it change for each build type:

The Distribution Certificate is the name of the certificate that was used to sign the provisioning profile for your app (please refer to part 1). The Mobile Provision File is the location of the provisioning profile you created in part 1. This is the path to the file on your Mac, not on your Windows machine  (whether virtual or otherwise).

If you’ve filled out these parts correctly, you should now be able to create an ad-hoc build of your app. In the project manager, under Target Platforms, expand iOS Device, then Configuration and select Ad-hoc:

In the main menu, click Project, then Deploy. The name of this function is sort of confusing because it doesn’t actually deploy the application to your device. It does however, create the .IPA file necessary for distributing your app. By default, the .IPA file will be under your project directory, in the iOSDevice folder, in the Debug folder if you’re creating a debug build, or in the Release folder if you’re creating a release build.

To distribute your app, you’ll need a webserver; either one of your own, or one that is being hosted for you. There’s a couple of requirements that need to be met in order for this to work. Firstly, the webserver needs to have the correct MIME type configuration. This can be for the entire server, or for the instance that is your website, or even just the directory that your files will reside in. If you are doing this yourself, please check your webserver documentation as to how to alter the MIME type configuration. If your website is being hosted by someone else, they may have added these already. The required MIME types are:

application/octet-stream ipa
text/xml plist

In order to configure the distribution files correctly, you will need to know the absolute path on your website to the files associated with your distribution, e.g. http://www.mydomain.com/myapp. The URL forms the basis for the details included in the distribution .plist file. This file is what the device looks at first to determine what it is actually downloading, and has references to the images that appears on the device when it starts the download/install process. I have included a template .plist file here:

[wpdm_file id=1] which you can use to customise for your application. Please use a “unix eol friendly” (i.e. treats end of line characters as LF, rather than CRLF) editor to edit the file. The template is fairly well commented so it should be easy enough to follow. The required items are:

The URL to the .IPA file (software-package key), e.g. http://www.mydomain.com/myapp/myapp.ipa

The URL to the image that shows when downloading the app (display-image key), which is a 57×57 non-transparent .png file, e.g.: http://www.mydomain.com/myapp/myapp57x57.png.
(note: this file doesn’t have to be in the same location, but it makes sense to keep them all together).

Bundle identifier (bundle-identifier key) – this is the same as the bundle identifier used in the project options, above.

Bundle version (bundle-version key) – this says optional, but it is actually required if the download type is software, which this is. Leave it as: 1.0

Download type (kind key) – leave it as: software.

Software title (title key) – make it the name of your app.

You could name the .plist file anything you like, however it is recommended that you at least include the app name, so for example you could name it: myapp.plist.

Now you can upload the required files to the website. As before, it makes sense to keep all the files together, however the .mobileprovision file must be in the same directory as the .plist file. The required files are:

the .mobileprovision file
the .ipa file
the image file
the .plist file

The last piece of the puzzle is a web page that will contain a URL to download your app from. This can be just a plain HTML file, however the link to download your app from must specify the correct protocol that the device will recognise. The format is:

<a href=”itms-services://?action=download-manifest&url=http://www.mydomain.com/myapp/myapp.plist”>Download MyApp</a>

Replace the url parameter in the example above with the correct URL that points to the .plist file you created earlier. You can also replace the MyApp in “Download MyApp” to your app name.

That’s it! Now your app can be downloaded to the devices you configured the app for in part 1, just by visiting the URL that contains the link to your app.