As every iOS developer knows, when your provisioning gets messed up, your life becomes a living hell. I don’t even want to think about how many millions of man hours have been wasted getting broken projects working again.
The root of the problem is always the
.mobileprovision files that are kept in your
Library > MobileDevice > Provisioning Profiles folder. The file either references a certificate that has expired or a device that no longer exists. There can also be issues with the entitlements that are contained in the profile when Team and App IDs don’t match.
A large part of the problem is that this file is not directly readable in a text editor like all the other parts of our Xcode projects. The file is encoded in the Cryptographic Message Syntax (CMS) described in RFC 3852.
After doing a bit of research, I found that decoding the payload of this file format is very simple thanks to some helpful functions in Apple’s Security framework. And once decoded, these .mobileprovision files contain nothing more than Property List (.plist) with a lot of useful debugging information.
I had previously been using a Quick Look plug-in from MacMation, but that site’s gone offline and the plug-in no longer worked in Mavericks. I had originally thought the problems on Mavericks were due to the new code signing requirements, but the root of the issue was that the content type UTI changed from
com.apple.iphone.mobileprovision to just
com.apple.mobileprovision so Quick Look ignored the old plug-in.
Eventually, I decided to write my own Quick Look plug-in and add a bunch of new stuff that I had been wanting to display:
- Developer certificates: Making it easier to verify that your keychain items match what’s in the profile.
- Provisioning Profile UUID: When someone on the project team checks in a new Provisioning Profile in the Build Settings, the only information you have is that UUID of that new file. Showing the UUID lets you find the right match.
- Entitlements: Checking the Push Notification environment, ubiquity container identifiers, and keychain access groups is essential for any app that uses Apple’s services.
- Links: Whenever the provisioning is broken you spend a lot of time in various sections of the Dev Center. Why not make it easy to get there?
The results of a few days work can be found on GitHub. If you’re lazy like I am, just download the
.qlgenerator file and pop it in your
Library > QuickLook folder. To get Quick Look to recognize the new plug-in you’ll need to either logout or poke Quick Look from the command line:
$ qlmanage -r
While you’re at the command line, do this to allow text to be copied from any Quick Look plug-in:
$ defaults write com.apple.finder QLEnableTextSelection -bool TRUE $ killall Finder
(Macworld has more info about this nice hidden setting. Being able to copy text from a PDF preview is pretty damn handy!)
The next time you’re stuck in the Fifth Circle of Provisioning Hell, this simple plug-in may just bring you back to life. Viva!