Deploying an Application

Now that you’ve written your first iOS application and run it on the simulator, it’s time to deploy it to a device.

To install an application on your development device, you need a developer certificate from Apple. Developer certificates are issued to registered iOS Developers who have paid the developer fee. This certificate grants you the ability to sign your code, which allows it to run on a device. Without a valid certificate, devices will not run your application.

Apple’s Developer Program Portal (http://developer.apple.com) contains all the instructions and resources to get a valid certificate. The interface for the set-up process is continually being updated by Apple, so it is fruitless to describe it in detail. Instead, use the Development Provisioning Assistant, a step-by-step guide available on the program portal.

Work through the Development Provisioning Assistant, paying careful attention to each screen. At the end, you will have added the required certificates to Keychain Access and the provisioning profile to Xcode.

If you’re curious about what exactly is going on here, there are four important items in the provisioning process:

Developer Certificate
This certificate file is added to your Mac’s keychain using Keychain Access. It is used to digitally sign your code.
App ID

The application identifier is a string that uniquely identifies your application on the App Store. Application identifiers typically look like this: com.bignerdranch.AwesomeApp, where the name of the application follows the name of your company.

The App ID in your provisioning profile must match the bundle identifier of your application. A development profile, like you just created, will have a wildcard character (*) for its App ID and therefore will match any bundle identifier. To see the bundle identifier for the Quiz application, select the project in the project navigator. Then select the Quiz target and the Summary pane.

Device ID (UDID)
This identifier is unique for each iOS device.
Provisioning Profile
This is a file that lives on your development device and on your computer. It references a Developer Certificate, a single App ID, and a list of the device IDs for the devices that the application can be installed on. This file is suffixed with .mobileprovision.

When an application is deployed to a device, Xcode uses a provisioning profile on your computer to access the appropriate certificate. This certificate is used to sign the application binary. Then, the development device’s UDID is matched to one of the UDIDs contained within the provisioning profile, and the App ID is matched to the bundle identifier. The signed binary is then sent to your development device where it is confirmed by the same provisioning profile on the device and finally launched.

Open Xcode and plug your development device (iPhone, iPod touch, or iPad) into your computer. This will automatically open the Organizer window, which you can re-open by clicking the Deploying an Application button from the top right corner of the workspace. You can select Devices from the top of the Organizer window to view all of the provisioning information.

To run the Quiz application on your device, you must tell Xcode to deploy to the device instead of the simulator. Locate the pop-up button named Scheme in the top left of the workspace window. Choose iOS Device from the list. (If iOS Device is not an option, find the choice that reads something like Joe Conway's iPad.) Build and run your application (Command-R), and it will appear on your device.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.163.62