View embedded ad-hoc provisioning profile in an iOS .ipa file

Question

How to check out UDID numbers of test devices that are on the embedded ad-hoc provisioning profile list of my iOS 8 application? The .ipa file is compiled by Xcode 6.2 and exported for ad-hoc deployment through its Organizer. Machine: iMac, OS X Yosemite 10.10.2., so my question is: how can I check which devices are associated to my ad-hoc provisioning profile for the given iOS application?

Solution

You want to look into the compiled .ipa to see how the Xcode Organizer has packaged your application. Recommended steps:

1. Locate the generated myproject.ipa file. Rename it to myproject.zip. For example: /Users/me/Projects/Reutte/Reutte.ipa -> /Users/me/Projects/Reutte/Reutte.zip.

2. Uncompress myproject.zip file. Note the Payload folder.

3. Open Terminal. Change current location to the Payload folder. For example: cd /Users/me/Projects/Reutte/Payload. Find your .app file there, in this case: Reutte.app.

4. In the Terminal execute this command: security cms -D -i myproject.app/embedded.mobileprovision. The provisioning profile will be shown.

For example:
$ cd /Users/me/Projects/Reutte/Payload
$ security cms -D -i Reutte.app/embedded.mobileprovision

5. Locate the ProvisionedDevices key. Provisioned devices are there. For example:

<key>ProvisionedDevices</key>
    <array>
        <string>b771456d3ee7e19014550d1813f017fc5061657a</string>
    </array>
....

When you see something strange then check out the list on your Apple iOS developer portal and be sure to use the latest ad-hoc provisioning profile that includes all of the provisioned devices. Download and load it (double click). Sometimes the Xcode needs to be refreshed. See Xcode -> Preferences… -> Accounts -> your dev Apple ID -> select your registered project -> View Details -> Refresh. In the Xcode, select your project -> Build Settings -> Code Signing group. Look at the Code Signing Identity and Provisioning Profile settings. All should be set properly.