Wednesday, December 5, 2012

Add New Devices to a Mobile Provisioning Profile


On my previous post I wrote on how to create an iOS relase build for ad-hoc distribution. But soon after I created and published a release build for a cliente, I was confronted with an aditional challenge. What if I want to add additional devices to the distribution package?
If you do a small search on the web and forums the news you’ll get is that you have to go through the complete packaging process again and again for each new device.
The news I have is: YOU DON’T!! What you have to do is update the existing mobile provisioning profile with the new device’s ID and distribute it along side with the original application's package. 

Here’s a step by step.

Get the device’s Unique Identifier

The first step is to get the unique identifier of the device
  1. Connect the device to the computer via USB
  2. Start iTunes
  3. In iTunes select, in the right column, the device
  4. On the Summary tab press on the text of Serial Number


  1. After pressing the text displays the identifier (UDID)
  2. Press Ctrl + C (Windows) Cmd + C (Mac)


Add the new device to your company’s Apple account

  1. Go to https://developer.apple.com/membercenter and log in
  1. Press iOS Provision Portal
  1. On the left column select Devices
  2. At right press the Add Devices button
  1. In Device Name field assign a intuitive  name to the device.
  2. Fill the the device’s ID field with UDID you copied earlier
  1. If you need to add more equipment press the + button to the right
  1. At the end press Submit and the new equipment is added

Associate the new device to the application’s distribution license

  1. In the left column press Provisioning
  2. Select the Distribution tab
  1. In the row that corresponds to the distribution license press Edit on the right and then select Modify
  1. In the Devices Section you should see the newly added. Select it, and all the devices you wish to assign to the license
  2. Submit Press when finished
  1. After you press Submit the license status may be in Process. If this happens press the F5 key to refresh the page. The status should switch to Active.
  1. Press the Download button to download the license file. The file name is [LicenceFileName].mobileprovision

Distribute your licence and app files

There are two ways you can send the application and licence files to your users.
  1. One is by email. Then the user can install both files with iTunes. First the licence file and then synchronize the application file.
  1. The other way is to publish both files on a web server just like on this previous post.
In order to go with the second option, follow these steps.
  1. Go to this previous post and follow the same last steps on how to configure the webpage
  2. Then on the index.html file you must add also a link to the licence. The complete code is as follows
<body style="height: 100%;">
  <ul>
    <li>
<a href="http://[ServerName]/[LicenceFileName].mobileprovision">
Download Licence</a>
    </li>
    <li>
       <a href="itms-services://?action=download-manifest&url=
               http://[ServerName]/[AppFileName].plist">
           Download Application</a>
    </li>
  </ul>        
</body>
  1. You also must add a new MIME type for the licence file
.mobileprovision application/octet-stream
This web page will have two links. One for the licence file and the other for the application installation package.
The application package is the same that was generated on this previous post.
Installing the application in new devices
To install the application, you must first install the licence and then the application. Send the link of the webpage by email.
  1. To install the licence you must click on the Download Licence link
  2. Install the licence clicking on Install
  1. After the licence is installed. Press OK.
note: If when downloading the certificate an error message appears, this can mean that the device is not authorized to use this application, that is, the UDID of this device is not associated with the licence
  1. Return to the web page and click Download Application. This will initiate the download and installation of the application.
And you’re done. If you need to add more devices, just repeat the process. At the end, on the webpage, replace only the licence file (.mobileprovisioning file).