This Cyber Monday Tuts+ courses will be reduced to just $3 (usually $15). Don't miss out.
This tutorial will teach beginning iOS SDK users how to install apps on their iPhone OS hardware for testing and development.
App Install Requirements:
- An Apple Developer Account (Free Signup)
- iPhone Developer Program Membership ($99 per year)
- An iOS Development Device (iPhone, iPodTouch, or iPad)
Step 1: Login to the iPhone Provisioning Portal
Login to your Apple Developer account by navigating to http://developer.apple.com/iphone. Once there, navigate to the iPhone Provisioning Portal.
Step 2: Install the WWDR Intermediate Certificate
The first thing we will need to do is download the WWDR Intermediate Certificate. Once in the portal, click on “Certificate” in the sidebar and you will be presented with a link to download the “WWDR Intermediate Certificate.”
Download the file and double-click to add it into the Keychain Access program on Mac OS.
Step 3: Create a Development Certificate
Next, we will need to download a certificate for development. To get the development certificate, we will need to generate a “Certificate Signing Request” from within Keychain Access.
Open the Keychain Access program on your mac. It can be found under Applications > Utilities > Keychain Access, or just by searching for “Keychain Access” with Spotlight.
Once open, go into the “Keychain Access” drop-down menu in your menubar and select “Certificate Assistant” and then “Request Certificate from A Certificate Authority.”
A window will popup. Fill the window in with your information, but leave “CA Email Address” blank, and select “Save To Disk” from the radio buttons. Save it to a location that is easy to find, like your desktop, because you will need the file shortly to generate the certificate.
Head back into the “Certificate” section of the Provisioning Portal and make sure you have selected the “Development” tab. From there, press “New Certificate” and upload the request you made on your desktop. You may need to refresh the page in a few moments to change the status from “Pending” to available for download. If you are working as a team member on a larger project, you may need your manager to approve the certificate request.
Hopefully all went well, and you were able to create a certificate. Go ahead and download the certificate, then install it by double clicking the file or, if Keychain Access is open, drag the file over the Keychain Access icon in the dock.
Step 4: Create an App ID
Next we need an App ID. Return to the Provisioning Portal and select the “App IDs” option from the menu on the left.
There are two distinct App ID types to choose from.
One approach is to create an App ID for a single application. This will allow you to enable advanced features like In-App Purchases, Game Center integration, or Push Notifications. To do this approach, structure the bundle identifier as follows:
If you would like to create an App ID for a single application, fill out the screen as displayed:
The second approach is called a wildcard bundle ID. This approach will allow you to create an App ID that can be used for multiple applications that you would like to share a keychain between.
To take this approach, fill out the form as displayed:
Step 5: Find & Add Your Device UDID
Select the “Devices” link from the left menu in the “Provisioning Portal.”
In-order to add a device, you will need the device’s unique device identifier, also known as the UDID.
To get the UDID, plug the device into iTunes and select your device in the list. In the device’s “Summary” tab, there will be a description called “Serial Number” next to the picture of the device. Click once on the serial number and it should change to “Identifier”, or your UDID. Copy your UDID to the clipboard. (Command + C on Mac/Control + C on Windows)
Another approach is to simply download one of the many free “UDID” applications in the App Store, and e-mail or copy the UDID from that app.
After you have your UDID, click on add device from within the devices tab in the Provisioning Portal. Enter a name under “Device Name” and enter the UDID under “Device ID”.
Step 6: Create & Download Provisioning Profile
Now that you have added your device and made an App ID, we can generate a provisioning profile.
Select the “Provisioning” tab from the left menu. Make sure that the “Development” tab is selected, and click the “New Profile” button.
I named my new Profile “Developer”. Under certificate choose your development certificate, and under App ID, choose the ID we made in step 2. Under devices, select all the devices you have that you are going to use for development.
Press “Submit” to be brought back to the overview page for provisioning. Once on this page, if the status is set to "pending" you will need to refresh your browser before being able to select “Download.” If you are a team member on another's account, you may need to wait for them to approve your certificate creation request. Download the certificate to continue.
Step 7: Install Provisioning Profile
In this step, we will install the profile to your device and to Xcode.
Make sure your device is connected, and from your downloads folder drag the Provisioning Profile onto the Xcode icon.
Then go into Xcode and open the organizer by going to Window > Organizer. There you should see your devices name on the left. Click on your device that has a green dot next to it and make sure it is allowed to be used for development, by clicking on “Use for Development” if it presents itself.
In the device summary info you should see a table called “Provisioning”. Drag and drop the provision profile from your downloads folder into that as well.
Step 8: Configure Build Settings
In this step, you will build your application to run on your device.
In your Xcode project, open the info.plist file from the “Groups & Files” pane. Fill in the “Bundle Identifier” value with the one created earlier and associated with the App ID.
Finally, select Project > Edit Project Settings from the Xcode menu bar or just right click or control click on the project file as shown below:
A new window should open. Select the “build” tab on this window.
Scroll down to the “Code Signing” section and select the correct provisioning profile identity from the drop down menu associated with the iOS device.
Step 9: Run On Device
Before you build and run, be sure to select "Device" from Project > Set Active SDK in the Xcode menu bar. Also be sure that you have selected the correct device from Project > Set Active Executable. Finally, be sure that your iOS device is turned on, connected to your computer, that it is recognized by iTunes, and that your screen is not locked.
You should now be ready to build, install, and run your first application on your iOS hardware! Click the "Build & Run" icon, and Xcode should take care of the rest.
Hopefully everything worked! Leave comments, questions, and feedback below.