Notes: 12. Ad Hoc Distribution
iOS App Distribution & Best Practices, Chapter 5: https://www.kodeco.com/books/ios-app-distribution-best-practices/v1.0/chapters/5-internal-distribution
As the name states, Ad Hoc Distribution is indeed a distribution style, so it has some similarities with regular App Store distribution, and some differences. Whenever you are distributing an app, you’ll need the following:
An Apple ID enrolled in the developer program. You should also be signed into Xcode with this Apple ID.
An App Id registered in the developer portal for the example kodeco.com app that is provided in the course materials. You used this project back in part 1 to test submitting an app to App Store Connect.
You need a distribution certificate. You should also have one of these from earlier in the course, so go back and check that out if you don’t.
Finally, you’ll need an iOS device, which must match the app’s deployment target.
So what makes Ad Hoc distribution different from a normal App Store distribution? Ad Hoc distributions are limited to a specific set of devices that you define, so our picture of what makes a provisioning profile changes just a bit.
We now need to tell the profile where the app can run, by specifying a device UDID, or unique device ID.
Let’s go look at a demo, where you’ll learn how to find a device’s UDID, register it and then build your app using it.
Demo
The easiest way to find a UDID for a device is to connect to it your computer, and use Finder. My device is already connected here, so I’ll select the device in the left hand menu.
This will open the Device Management Pane for the selected device.
Right under the name of the device in that panel is some text. It doesn’t look clickable, but it is. Do so, and then right click and choose “Copy UDID”.
To register this device in the Developer Portal, go to the developer portal and go to the devices section. Click the plus button to register the UDID.
Pick the appropriate platform from the drop down, the device name and the UDID. Be sure to have the name be descriptive enough to know whose device it is in case you need to reach out to that user directly during testing. Click continue to register the device.
Another technique is to let Xcode register the device automatically. This will happen if an unregistered device is connected to Xcode and you try to run an app on that device.
Now you need to make a provisioning profile with this device. For a regular App Store distribution profile you don’t need to do this, since that profile runs with any device that can reach the App Store.
Go to the Profiles section of the developer portal, and click the plus button to make a new one. Choose Ad Hoc from under distribution. Select the appropriate App ID and distribution certificate. After that you can select the devices you want to associate with this profile.
Give the profile an appropriate name and click generate. Then download the profile. Double click it to install it on your machine so Xcode can access it. At this point you can also see your certificate in Keychain Access, since it has been installed on your system.
To use this profile, go back to the Xcode project, and deselect “Automatically Manage Signing” under the “Signing and Capabilities” tab of the target.
Ad Hoc distribution can only be performed in release mode, so you need to dive a bit into the build settings to set release configuration settings.
Under the signing section of the Build settings, change the Code Signing Identity to Apple Distribution
The development team should be correct for both Debug and Release; if not, set them accordingly.
Change the release Provisioning Profile to the profile you just created and downloaded a few minutes ago.
At this point, the process of making a build is the same as before, except you will choose the Ad Hoc distribution method instead of the App Store Connect method. Select the appropriate provisioning profile and on the next screen click Export. This will let you save the files to your Mac. The .ipa, or iPhone Application Archive, file here is your app!
Lecture
Once you have your app, there are various methods to distribute it to the devices that match your list of possible UDIDs.
The IPA file you generated is simply that - a file. You can send it via email, or place it someplace like DropBox, as long as the device in question can get to it.
You can also drop the IPA file directly onto the Device management section of your iOS device in Finder to add the IPA file.
You can also deploy the app over the air, or OTA, to the desired devices. The iOS App Distribution and Best Practices book has a great walkthrough of how to accomplish this. I’ll leave a link in this episode’s notes so you know right where to go.