Update: it was pointed out to me by @lieven that the technique described here no longer works since Apple introduced iOS8 and Xcode 6.
As you get close to submitting your app to the App Store, you really want your test builds to be as close as possible to the submitted binary. This is why we typically use Ad Hoc builds for our final test sessions, even when using enterprise distribution for earlier builds. But even with Ad Hoc builds, you still end up submitting a different binary, an App Store build that has never been installed on a real device. I have always felt slightly uncomfortable about this. No matter how solid your automated build system is, there always remains a tiny chance that something is wrong with your App Store build and you won’t be able to detect this before actually submitting the app.
However, it turns out that you can in fact install an App Store build on a test device. We discovered this more or less by accident, while trying to explain the difference between Ad Hoc builds and App Store builds to an interested customer. At that point, the App Store build had already been submitted and approved (awaiting release), but we still worried that something might be wrong with it at first.
The key to making this work is to ensure that an Ad Hoc provisioning profile is installed on the target device. This profile should reference the same bundle identifier and signing certificate that are used for the App Store build, and the list with provisioned devices should include the target device. One way to get this Ad Hoc profile on the device is to install an Ad Hoc build with the profile embedded in it, but you can also install just the profile itself. Once the Ad Hoc profile is on the device, you are ready to install your App Store build. The App Store build has its own embedded provisioning profile, with no provisioned devices in it, but apparently other compatible profiles on the device are also considered when installing a new build.
Now I am pretty sure this hasn’t always been possible. Back in 2009, when I first started developing iOS apps, the rules were pretty clear: Ad Hoc builds are for testing, App Store builds are for submitting. Previous versions of the iOS App Distribution Guide included the following note:
“App Store provisioning profiles do not allow for a distribution built application to be installed on an Apple device. To install your distribution ready application on a device, you must create an Ad Hoc provisioning profile.”
I could not find any reference to this note in the current version of the guide, but strictly speaking it does not contradict what is currently possible, i.e. you still need to create an Ad Hoc provisioning profile in order to install a distribution ready build. The cool thing is that this distribution ready build can be the exact same binary you submit to the App Store.