iOS Code Signing: Under The Hood

This is a guest post by Adam Eberbach, a mod on the forums and a full-time iOS developer in Melbourne, Australia for Intunity, a local consultancy. Many beginner iOS developers cringe when they think about bundle identifiers, provisioning profiles, App IDs, or certificate signing requests. It’s a lot of new and confusing terminology coming all […] By Ray Wenderlich.

Leave a rating/review
Save for later
Share
You are currently viewing page 3 of 3 of this article. Click here to view the first page.

Signing for personal use

So you have an app you’re ready to test, you are signed up for the Apple iOS member program and you’re looking at the Provisioning Portal. Now you know the objects involved and how everything fits together, things get easy.

  1. Check your public/private key pair, name them for future peace of mind. (warning sign: more than one pair...)
  2. Create your developer certificate using Keychain Access to generate a certificate request. Download the certificate and double click to install. Verify that you see it in your keychain.
  3. Download the Apple Worldwide Developer Relations Certification Authority Certificate. Double click to install it, verify that you see it in your keychain.
  4. Check your project’s Bundle ID and go and create an App ID for your app through the Provisioning Portal. The Bundle ID must match.
  5. Get all the UDIDs for the devices you want to build for added to your devices list in the Provisioning Portal. These must match. Cut and paste of these 40-digit strings is highly recommended, too easy to make mistakes otherwise.
  6. Create a Provisioning Profile specifying the certificates, the app ID and the UDIDs you want this profile to support.
  7. Download, then drag the profile into Xcode’s Organizer window, under the Library section for Provisioning Profiles.

That’s it!

You should now be able to choose to sign projects and run them on your device. In the Target’s (not the Project’s!) Build Settings, scroll down to the Code Signing section. Start with the Debug scheme for now. It is easier, especially if working in a team, to select “iPhone Developer” in the Automatic Profile Selector and see your certificate selected automatically. That way your “best” current certificate is selected - if someone on your team checks out the project5 their profile will be selected for them. It’s the same idea as the new “Latest iOS” setting when selecting Base SDK, one less trivial thing to update.

When you have done this you should see Xcode show something like the picture. Xcode has correctly identified the Provisioning Profile based on the App ID and certificate. If you connect your device to the Mac now, select the device and Debug build in the build selection pulldown and build, Xcode will install the provisioning profile and start to run your app on the device.

Congratulations - there’s nothing much harder about iOS programming than getting through this step. Every other aspect of provisioning builds on this result, and you are now equipped to test the way apps must be tested, and you will soon be able to build and submit to the store.

Where To Go From Here?

For more information on iOS code signing, check out the great documentation available on the iOS Provisioning Portal.

Also, stay tuned for the exciting conclusion to this two-part article series, where I’ll cover signing and provisioning for distribution, and using Archives in Xcode 4 to make the whole process easy. For certain values of “easy”.

If you have gotten stuck somewhere in the process of code signing, or have tips and tricks for other developers, feel free to join the forum discussion below!

This is a guest post by Adam Eberbach, a mod on the forums and a full-time iOS developer in Melbourne, Australia for Intunity, a local consultancy.

Contributors

Over 300 content creators. Join our team.