«Table of Contents Recommended Software Signing up for the Developer Program Provisioning, The Easy Way Provisioning, The Hard Way Getting Your ...»
iOS Device Provisioning
the Big Nerd Ranch Guide
When students are preparing to attend one of our iOS Bootcamps, we typically recommend
that they sign up in advance for the Apple Developer Program, and bring a provisioned device
with them. As this can be a somewhat involved process to troubleshoot, we don’t have time to
spend on this at the beginning of our already jam-packed week.
Here’s a guide, then, to how you can complete the process at home.
This is a “living document” like Apple’s App Store Review Guidelines. I will periodically come back and update it whenever Apple updates the developer tools or portal.
Table of Contents Recommended Software Signing up for the Developer Program Provisioning, The Easy Way Provisioning, The Hard Way Getting Your Certiﬁcate Adding Your Device Generating Your Proﬁle Testing Your Setup Troubleshooting Changelog Recommended Software
This guide and our course materials are based on the following software versions:
Xcode: 4.6.3 iOS: 6.1.3 / 6.1.4 depending on device OS X: 10.8.4 At any given time, especially during the Summer, it is likely that there is a more recent (beta) version of Xcode available from the iOS Developer Portal.
We strongly recommend to our students that they come to class using the most up to date software versions listed above. Running outdated or beta software can slow your progress signiﬁcantly during class.
If you need to update your system software either on your Mac or on your iOS device, we strongly recommend that you do so before arriving.
Apple has guides for updating your iOS and OS X versions, and you can download the most recent version of Xcode from the Mac App Store.
Signing up for the Developer Program Anyone can test iOS apps in the iOS Simulator that ships as a part of Xcode.
If you want to test your apps on your device, however, you must be a paid member of the iOS Developer Program.
If your company has an app on the App Store, it is possible that you might be able to use the company iOS Developer Program membership rather than paying for your own. Even in such cases, I typically recommend that folks have their own personal memberships; life is so much easier with one, and it’s only $99.
You can enroll in the Standard iOS Developer Program on Apple’s website.
Except where explicitly stated otherwise, the rest of these instructions will assume that you have an individual iOS Developer Program membership.
Provisioning, the Easy Way Recent versions of Xcode have built in functionality to make the process of setting up a device very easy. This works just ﬁne most of the time.
Connect your iOS device to your Mac via the USB cable Launch Xcode and show the Organizer window (select Organizer from the Window menu) Switch to the Devices tab of the Organizer, and select your device from the list on the left.
Click “Use for Development”.
Xcode will begin the process of chatting with Apple’s servers and may ask some questions about requesting certiﬁcates, adding your device to the portal, and ﬁnally generating and downloading your provisioning proﬁles. Answer any of these in the afﬁrmative.
If the little gem next to your device in the Organizer device list turns green, you’re done! Skip down to the Testing Your Setup section. Yeehaw!
If the gem didn’t turn green, then there was a hiccup in the automatic process, and you’ll need to do it manually. Continue to Provisioning, The Hard Way.
Provisioning, the Hard Way Getting Your Certiﬁcate The ﬁrst ingredient you’ll need is a secure certiﬁcate that you can use to digitally sign your apps before they’ll run on the device.
Launch the Keychain Access application on your Mac. It lives in the Utilities subfolder of the Applications folder. You can also ﬁnd it with Spotlight.
Select My Certiﬁcates from the left-hand sidebar. You should see a list of certiﬁcates you have on your system.
There is one certiﬁcate in particular that you’re looking for. It’s named iPhone Developer:
Your Name (XXXXXXXXXX):
Don’t worry if you don’t have an entry like this, or even if the entire list is empty. That’s what you’re here to ﬁnd out.
If you see an item like the one above, click on the little gray disclosure triangle to its left, to expand it. You should see a sub-item with an icon that looks like a key, and has “private key” in the “kind” column, as illustrated above.
If you see an “iPhone (or iOS) Developer” certiﬁcate and it’s got a private key attached to it, then you’re done with this step! Continue to Adding Your Device.
If you don’t have a certiﬁcate, or you have a certiﬁcate without a private key, then you’ll need to go through the certiﬁcate generation process. Let’s get started.
Select Request a Certiﬁcate From a Certiﬁcate Authority… from the Certiﬁcate Assistant sub-menu of the Keychain Access menu at the top of the screen. This will launch the Certiﬁcate Assistant.
For the User Email Address, enter your Apple ID email address. Enter your name for the Common Name, select Saved to Disk from the options at the bottom, and then click Continue.
When asked, let the Certiﬁcate Assistant save the ﬁle (named “CertiﬁcateSigningRequest.certSigningRequest” by default - that’s ﬁne) to your Desktop. You’ll need that ﬁle shortly. Click Done.
Next, sign into the Certiﬁcates, Identiﬁers & Proﬁles page of the iOS Dev Center.
You should be looking at the certiﬁcate, device, app, and provisioning proﬁle management resource, with your Certiﬁcates list (which is probably empty) currently selected. I recommend bookmarking this page; it’ll come in handy.
Click on the + button to launch the “Add iOS Certiﬁcate” assistant.
The ﬁrst question is, “What type of certiﬁcate do you need?”, and the answer is iOS App Development. Select this option and scroll down, then click Continue.
This next page walks you through steps you’ve already taken. Click Continue again.
On this page, titled “Generate your cerﬁcate”, click Choose File… and select the CertiﬁcateSigningRequest.certSigningRequest ﬁle that you created earlier in Keychain Access and saved to your Desktop.
Click Generate. The page will take a brief coffee break while it crunches some numbers and generates the certiﬁcate you’ve requested.
When the page resumes, you’ll have a Download button. Click it to download your freshlyminted certiﬁcate.
Click Done, and you’ll be returned to the Certiﬁcates list. You should now see a line item here with your name, “iOS Development” as its type, and an expiration date one year from now.
Go ﬁnd the “ios_development” ﬁle you’ve downloaded (it’s probably in your Downloads folder), and double-click it. Keychain Access will pop back up, asking where you’d like to import this key. Make sure your login keychain is selected, and click Add.
Return to Keychain Access once more, and verify that you now see a certiﬁcate under My
Certiﬁcates with a private key associated with it:
If you do, you’re clear to go on to the next step, Adding Your Device. Otherwise, something went wrong, and you may want to retry this step or have a look at some of the advice in the Troubleshooting section below.
Adding Your Device You made it! Things get easier from here, I promise.
Next, it’s time to identify your device to Apple so that Xcode can sign each of your apps to run on your device.
Back in the Xcode Organizer, have a look at your device. The number named “identiﬁer” (also called Universal Device Identiﬁer, or UDID) is a 40-character alphanumeric string.
Copy it to the clipboard, like you would any text.
Back in the Certiﬁcates, Identiﬁers & Proﬁles page of the iOS Dev Center, click Devices in the left-hand sidebar. Here’s a link in case you’ve closed the page already.
If you already see your device in this list, excellent! Continue to the next section, Generating Your Proﬁle.
If you don’t see it, click on the + button in the upper-right corner to add a new registered device.
On the next page, enter a name for your device, and paste the UDID that you copied from the Xcode Organizer.
You’ll be asked to double-check the submission, for a good reason. Do it, then click Register.
You’ll be dropped back at the list of your devices, but there is now an item for the device you’ve just added.
Move on to the next section, Generating Your Proﬁle.
Generating Your Proﬁle The ﬁnal piece of the puzzle that you need is a provisioning proﬁle. A provisioning proﬁle contains information about one or more developers (using your certiﬁcate), one or more devices, and either an App ID or a Team ID. You already have a Team ID (it was automatically generated for you), so all of the bits should be in place to create the provisioning proﬁle.
Xcode is responsible for creating one for you, and keeping it in sync with the iOS Dev Center.
Open the Xcode Organizer again, and visit the Library’s Provisioning Proﬁle’s list.
Click Refresh. Xcode will begin chattering with Apple’s servers again, like it did if you attempted Provisioning, The Easy Way. This should generate your iOS Team Provisioning Proﬁle.
When it’s done, look at the list again. You should see an item that looks like this:
The important bit here is that green checkbox, and the words “Valid proﬁle.” If yours is missing, or says anything other than “Valid proﬁle,” you’ll need to do some troubleshooting.
Testing Your Setup It’s time to test an app! Woohoo!
First, connect your device and leave it connected for the rest of this test.
In Xcode (not the Organizer), select New Project… from the File menu at the top of the screen. This will begin the New Project assistant.
In the left-hand sidebar, select Application from the iOS group, and choose the Utility Application template and click Next.
Fill out the short questionnaire about your new project and then click Next:
The values that you enter aren’t terribly important; you’re just going to delete this project anyway.
The last step of the New Project assistant is choosing a save location for your project. Choose your Desktop and click Create.
Welcome to Xcode! There’s an awful lot going on here, but we’re only interested in a very small piece of what Xcode can do.
If your device has a passcode, wake the device now and key it in so that you’re looking at the device’s Home Screen.
Have a look at the Scheme dropdown near the top-left of the window:
Select your device in the Scheme dropdown, and then click Run.
It’ll take a few moments (I’ve had it take upward of 10 seconds on a slow computer) your device’s screen should turn black, and then launch the utility template app!
Congratulations! Your device is provisioned and ready for running your apps!
Troubleshooting Here are some common problems and things to try if you get stuck.
If you’re here because you’re preparing to take one of our Bootcamps and these steps aren’t working for you, be sure to let us know and we’ll help!
I don’t have an iOS Team Provisioning Proﬁle Back in your web browser, on the Certiﬁcates, Identiﬁers & Proﬁles page, select Provisioning Proﬁles from the left-hand sidebar.
You should see an iOS Team Provisioning Proﬁle. Click on it.
You’ll see that your proﬁle has at least one Certiﬁcate and at least one Device associated with it. Or maybe not.
The root problem may be:
If you have a team proﬁle, but the number of Certiﬁcates listed is zero, then something went wrong during the Getting Your Certiﬁcate step. I’d give it another go.
If you have a team proﬁle, but the number of Devices listed is zero, then the problem most likely happened while adding your device. Use the Adding Your Device instructions to verify that your device has actually been added. Double, even triple check that the identiﬁer that you see in Xcode matches the one in the iOS Dev Center’s devices list.
If your iOS Provisioning Proﬁles list on this page simply has zero items in it, then then Xcode failed to create the team proﬁle for you. The following instructions will walk you through creating a wildcard proﬁle that you can use instead.
Creating a Wildcard Provisioning Proﬁle Start by visiting the Certiﬁcates, Identiﬁers & Proﬁles page, and select App IDs from the lefthand sidebar.
If there are no items in the list here, go create an App ID ﬁrst, and then come back.
Next, verify that you have a valid certiﬁcate. Select Certiﬁcates in the left-hand sidebar. If this list is empty, read back through Getting Your Certiﬁcate to make sure you’ve done everything right. You may need to re-do that step from scratch, and then come back.
Provided at this point that you’ve got both a wildcard App ID (either one that was created for you, or that you created yourself), select Provisioning Proﬁles from the left-hand sidebar of the Certiﬁcates, Identiﬁers & Proﬁles page.
Click the + button toward the upper-right corner. This begins the Add iOS Provisioning Proﬁle assistant.
On the ﬁrst page, select iOS App Development from the list, and click Continue.
On the second page, select your wildcard App ID from the list, and click Continue.
On the third page, check the box next to your Certiﬁcate name, and click Continue.
On the fourth page, check the box next to your Device name, or Select All, and click (you guessed it) Continue.
On the ﬁfth page, name the proﬁle “Your Name Wildcard Provisioning Proﬁle”, and click ContiI mean Generate.
On the ﬁnal page, click the Download button, which will download a ﬁle to your computer with the extension.mobileprovision. Find this ﬁle (probably in your Downloads folder) and double-click it. This will open Xcode, which will then ingest and process the ﬁle.