Installing the App on the Device

you through the many steps required to set up and install the provisiong profile. Choose Launch Assistant on the home screen of the iPhone Developer Program Portal. The assitant will ask you a few questions and guide you through the installation process. Its docuemntation is quite good, so we won't elaborate here.

Manually Setting Up iPhone Provisioning

There are many steps when creating your provisioning profile manually. The first thing to understand is the difference on the site between development and distribution. You will need a development provisioning profile to build applications directly to your device instead of the simulator. This does not give you the abilty to share that application with anyone else, for a Distribution provisioning profile is required. You will need certificates and profiles for each type of provisioning. You will also need to assosiate your profiles with device Unique Device Identifiers (UDIDs). Because the process is identical for development and distribution provisioning creation, we will walk you through development and assume you can explore distribution on your own.

The first step in creating your Provisioning profile is creating your certificates. In the iPhone Developers program portal, click on Certificates in the left-hand side bar. You should see an information bubble telling you that you currently do not have any valid certificates like in figure 2-12. Click on the Request Certificate button to get started. You will have to create the certificate using Keychain Access on the Mac; the instructions should be listed on the page.

After you upload the Signing Request, a certificate will be generated. Once it has been "approved," you need to download it to your computer. This To do this, click the Download button next to the certificate. When its finished downloading, click on the file to launch Keychain Access. This will launch the certificate and install it to the keychain.

The last step on the Certificates page is to get the Apple WWDR certificate. There is a link to download it directly under the certificate you just created. This is the Apple Worldwide Developers Relation (WWDR) certificate, you need to download it and add it to your keychain. All you need to do is click on the WWDR certificate after it has downloaded, to launch Keychain Access and install it to your keychain.

After you have succefully installed your certificates, you are ready to register devices to your provisioning profile. Select Devices on the left side of the program portal. Under the Manage tab, there will be an Add Devices button. Click this to add a new device to your profile.

Finding Your Device ID

Your device is identified by a Unique Device IdentifierUDID. To add a device to a profile, you will need the device id, which can be found in two places: iTunes and Xcode. Verify that the device is connected to the computer and go to iTunes. Select the device from the Devices section on the left. This should reveal the summary page with some device specific information at the top (name, capacity, and so forth). If you click on the serial number, the device identifier will be revealed (see Figure 2-11). The other way to find your device identifier is to open Xcode and go to the Organizer window. You can get there through the top menu bar [Window > Organizer] or by using the keyboard (Shift+Command+O). Click on your device in the left-hand panel and it should reveal the summary page with the device ID. There is also a handy free application, AdHoc, that you can download from the App store that will automatically compose an e-mail with the UDID of the device.

Figure 2-11. iTunes Device UDID

Regardless of the way you choose to retrieve your device UDID, copy and paste it into the Device ID text field on the Developer Portals Device registration page, and give your device a name. This can be a common name, such as "Joe," or a device description, such as "Joe's work phone".

In the Program Portal, click on App IDs on the left side. App IDs are a unique combination of charactures used to differentiate applications. Click on the New App ID button to begin. It will then ask you for a general description or name for your App ID; this can be as simple as "MyiPhoneID" or "ProjectID." Try to keep the name specific to your application because this ID will be used throughout the portal to identify it. Next, you can choose to generate a new bundle seed ID or use an exisiting one if this application is part of a suite. Finally, you need to pick a Bundle Identifier for this application. To have this App ID cover any application that you are currently developing, simply put an astrisk (*) in this text field. This will allow any application to build, regardless of its name. To create a more specific App ID, the convention used is reversed domain-style strings, such as the example given in the portal "com.domainname.appname."

Create the Provisioning Profile

It's time to create your first provisioning profile. In the Program Portal, click on Provisioning. This area is where you will manage all of your development and distribution profiles. To start, click New Profile. Give your profile a name, such as "iPhoneAppDevPP" or "iPhoneAppDistPP." Check the certificate you created earlier, select the App ID you want to register with this profile, and finally select the devices you want to asociate with it. This will create your provisioning profile; all that's left is to download it and install it in Xcode.

Install the Provisioning Profile

Launch Xcode and go to the Organizer window located in the top menu bar at Window > Organizer or launch with the keyboard (Shift+Command+O). Make sure the device is connected and select it in the devices drop-down, located on the left side. Find the provisioning profile you downloaded and drag and drop the file into the Provisioning section of the window. Your organizer window should look like Figure 2-12. It should also have a green-colored dot (apposed to an amber-colored dot) next to your device name on the left. The green dot signifies your device is set up correctly.

Organizer

Build Clean Run Action

Restore iPhone

Provisioning

HelloiPhoneDevPP

Build Clean Run Action

Provisioning

HelloiPhoneDevPP

Figure 2-12. Xcode Organizer Window

Install and Run on the Device

Now that you have provisioning profiles set up on the device, you need to configure Xcode to use the proper profiles when you build your application. To do this, you need to modify the Project and Target Information windows.

Start by double-clicking the project file located under Groups & Files in Xcode. This file will be called HelloiPhone. This will launch the Project "HelloiPhone" Info window. Click on the Build tab and locate the section called Code Signing. Under Code Signing Identity, there should be an Any iPhone OS Device option. Clicking on the box to the right of this should provide you with a drop-down menu. Select the iPhone Developer that you created earlier in the iPhone Developers Portal. You need to do the exact same thing for the Target Info page now. Close the window and this time find the Targets drop-down under Groups & Files in Xcode. Double-clicking on the application "HelloiPhone" should reveal the Target "HelloiPhone" Info window. Once again, go to the Build tab and locate Code Signing. Drop-down Code Signing Identity and select the correct iPhone developer for the Any iPhone OS Device option. Close the window.

There is one final option you may have configured and that is the name of the application. If you decided to not use the asterisk (*) in the App ID section and gave your app a formal name, then you will need to edit the info.plist file. You can locate this file under resources in the HelloiPhone application drop-down in Groups & Files. Look for the Bundle identifier and name it exactly as you did in the portal. Save the info.plist file and you should be good to go.

In the top left-hand corner of Xcode, there is a drop-down that lets you decide whether you are building for the simulator or device. You want to have the active SDK set to the latest version of the device and the active configuration set to debug (unless you are building for distribution). Select Build and Go and the application will be compiled and installed to the device.

One last note: you can manage the applications that you are building from the Organizer window in Xcode. You may want to delete the application currently on the device before rebuilding it.

Mobile Apps Made Easy

Mobile Apps Made Easy

Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.

Get My Free Training Guide


Post a comment