One of the hardest things to figure out when starting iOS Development is how to work through the app provisioning process so you can test your app on a real device. In order to deploy your app on a device you need to belong to the iOS Developer Program. Visit http://developer.apple.com/programs/ios to signup. It costs $99/year for the standard program. This also includes a host of development tools, resources, technical support and distribution of your application via the Apple App Store when you’re ready to release.
Registering Your Device
Before you do anything, you’ll need an iOS Device, this can be an iPhone, iPod Touch or iPad. To register your device within the Provisioning Portal you need to find out the unique identifier (UDID) for your device. Plug your device into your Mac and open up Xcode. Select Window > Organizer. Choose your device from the left and you’ll see the details on the right. Copy the 40 character “Identifier” to your clipboard.Next login to the iOS Developer Center https://developer.apple.com/devcenter/ios/index.action. You should see the screen below.Select Devices to see the list of iOS Devices you have registered. To add a new one click the + plus button in the top right. Enter a name for your device, i.e. “Brian’s iPhone5″. Paste your device Identifier into the UDID space and click “Continue”.Once added, you should now see your device in the list.
Setup Your Developer Certificate
To sign development versions of your iOS App you need to have a certificate installed on your Mac. To begin, select “All” from under the Certificates section on the left. Just like adding a new device select the + plus button from the top right. Then choose “iOS App Development” under the “Development” section and click “Continue”.
Next you’ll need to create a Certificate Signing Request (CSR). Follow the directions on the screen below.Open “Keychain Access”, this can be found within your finder under “Applications > Utilities” or by searching “Keychain Access” in Spotlight. Then select “Keychain Access > Certificate Assistant > Request a Certificate From a Certificate Authority”. Enter your Email Address, Name and select “Saved to disk”, then click “Continue”.Save the Signing Certificate Request to your desktop.Next, go back to the iOS Developer Center and click the “Choose File…” button and select the file you saved to your desktop.Your certificate is now generated, so click the “Download” button to save it to your computer. Find the file within your “Downloads” directory and double click it to install it into the Keychain Access. You should be able to click the arrow to the left of the certificate to see the private key under it. If you see this private key then you’ve installed the certificate correctly, if not try creating the certificate again.
Registering Your App
With every app you want to run on your device you need to register it within the iOS Developer Center. Click “App IDs” from the left menu under the “Identifiers” section. Just like we’ve done before select the + plus button from the top right to register a new App ID. Enter the Name of your app (this is not the name you’ll see in the App Store but for you to identify your app in your list of apps. Then enter a unique Bundle ID. This cannot be changed after this screen. Use the reverse-domain name style, i.e. com.rogers.ledbaseball, then click “Continue”.Review your application details and click “Submit” to finalize your App ID.
Create The Provisioning Profile
Now that we have our device registered, your certificate installed and our App ID setup it’s time to link them together in a Development Provisioning Profile. Click “Development” from under the “Provisioning Profiles” section on the left menu. Then like before click the + plus button in the top right to create a new provisioning profile. Click “iOS App Development” under “Development” and click “Continue”.Select the App ID that you just created from the dropdown list and click “Continue”. Select the certificate that you have installed on your Mac and click “Continue”. If you belong to a team of developers you’ll see their certificates listed. If you have an Individual account you’ll just see the one you setup. Select the devices that you would like to run the app on. It doesn’t hurt to “Select All”. If you need to add a new device in the future you will need to add the device to the iOS Developer Center, then update the Provisioning Profile to include the new device. Next enter a name for your Provisioning Profile. I like to add “Dev” to the end if it’s a Development Provisioning Profile and “Store” to the end if it’s a Distribution Provisioning Profile because it’s easier to distinguish them later in Xcode. Then click “Generate”. Click “Download” to save the new Development Provisioning Profile to your computer. Find the file within your “Downloads” directory and double click it to install it into the Xcode Organizer. You should then see the Provisioning Profile in the list of apps. If the status is “Valid profile” then the profile is setup correctly, if not then try starting from the beginning again.
Configure Your App
If you have a valid provisioning profile the rest should work with no problem. Open up the app that you want to install on your device in Xcode. Select the Info.plist under the Supporting Files group within the project. Change the Bundle Identifier to the App ID that you setup in the iOS Developer Center.Next click on the Project Settings and select “Build Settings”. Scroll down to the “Code Signing” section. Select the “Code Signing Identity” to see the dropdown. This dropdown lists all of the Provisioning Profiles installed on your computer. Select the name of the profile you just setup. Do the same with all of the options under “Code Signing Identity”. Ensure they are all selected to the app provisioning profile. Next click the Target of the App and select “Build Settings”. Just like you did for the Project Settings change all of the “Code Signing Identity” to the correct app Provisioning Profile. Note: If you do not see the new Provisioning Profile in the list, restart XCode and it should show up. Do the same with all of the options under “Code Signing Identity”. Ensure they are all selected to the app provisioning profile. That’s it, now in the top left of the toolbar in Xcode, select the scheme dropdown to choose your iOS Device that’s plugged-in. Build and run your app and it should show up on your device. Now you can test your app on a real device and show it off!