Appendix E. Testing on an Actual iPhone or iPod Touch

Although the iPhone Simulator is a very handy tool that allows you to test your iPhone applications without needing an actual device, nothing beats testing on a real device. This is especially true when you are ready to roll out your applications to the world — you must ensure that it works correctly on real devices. In addition, if your application requires access to hardware features on an iPhone/iPod Touch, such as the accelerometer and GPS, you need to test it on a real device — the iPhone Simulator is simply not adequate.

This appendix walks through the steps you need to take to test your iPhone applications on a real device, be it iPhone or iPod Touch.

SIGN UP FOR THE IPHONE DEVELOPER PROGRAM

The first step toward testing your applications on a real device is to sign up for the iPhone Developer Program at http://developer.apple.com/iphone/program/. Two programs are available: Standard and Enterprise. For most developers wanting to release applications on the App Store, the Standard program, which costs $99, is sufficient. Check out http://developer.apple.com/iphone/program/apply.html to learn more about the differences between the Standard and Enterprise programs.

If you just want to test your application on your actual iPhone/iPod Touch, sign up for the Standard program.

START YOUR XCODE

To test your iPhone applications on your device, you need to obtain an iPhone Development Certificate from the iPhone Developer Program Portal. The following sections walk you through the necessary steps from obtaining your certificate to deploying your applications onto the device.

First, obtain the 40-character identifier that uniquely identifies your iPhone/iPod Touch. To do so, connect your device to your Mac and start Xcode. Choose Window

START YOUR XCODE
Figure E-1

Figure E.1. Figure E-1

GENERATING A CERTIFICATE SIGNING REQUEST

To request a development certificate from Apple, you need to generate a Certificate Signing Request. You can do this using the Keychain Access application located in the Applications/Utilities/ folder (see Figure E-2).

Figure E-2

Figure E.2. Figure E-2

In the Keychain Access application, choose Keychain Access

Figure E-2
Figure E-3

Figure E.3. Figure E-3

In the Certificate Assistant window (see Figure E-4), enter your email address, select the Saved to Disk radio button, and select the Let Me Specify Key Pair Information check box. Click Continue.

Figure E-4

Figure E.4. Figure E-4

Choose a key size of 2048 bits and choose the RSA algorithm (see Figure E-5). Click Continue.

Figure E-5

Figure E.5. Figure E-5

You are asked to save the request to a file. Use the default name suggested and click Save (see Figure E-6).

Figure E-6

Figure E.6. Figure E-6

LOGGING IN TO THE IPHONE DEVELOPER PROGRAM PORTAL

After you have generated the Certificate Signing Request, you need to log in to Apple's iPhone Dev Center (see Figure E-7). Click the iPhone Developer Program Portal link on the right of the page. Remember, you need to pay $99 to have access to this page.

Warning

Be sure to register early because the approval process takes a while – from a few hours to a few days.

Figure E-7

Figure E.7. Figure E-7

On the iPhone Developer Program Portal page, click the Launch Assistant button (see Figure E-8) to walk you through the process of provisioning your iPhone and generating the development certificate.

Figure E-8

Figure E.8. Figure E-8

You should see the welcome page. Click Continue.

First, you are asked to create an App ID (see Figure E-9). An App ID is a series of characters used to uniquely identify an application (or applications) on your iPhone. Enter a friendly name to describe this App ID (to be generated by Apple). Click Continue.

Figure E-9

Figure E.9. Figure E-9

The next screen allows you to provide a description of your iPhone/iPod Touch. You need to provide the device ID that you obtained earlier (see Figure E-10). Click Continue.

Figure E-10

Figure E.10. Figure E-10

You are now ready to submit the Certificate Signing Request to Apple (see Figure E-11). The instructions on the screen show you the steps that you have performed earlier. Click Continue.

Figure E-11

Figure E.11. Figure E-11

In this screen, click the Choose File button to select the Certificate Signing Request file that you created earlier. After you have selected the file, click Continue.

Provide a description for your Provisioning Profile (see Figure E-12). A Provisioning Profile is generated so that you can download it at a later stage and install it on your device. Click Generate.

Figure E-12

Figure E.12. Figure E-12

A Provisioning Profile is generated (see Figure E-13). Click Continue when it's finished.

Figure E-13

Figure E.13. Figure E-13

You can download the generated Provisioning Profile onto your Mac by clicking the Download Now button (see Figure E-14). Next, click Continue.

Figure E-14

Figure E.14. Figure E-14

Drag and drop the downloaded Provisioning Profile (which, by default, is saved in the Downloads folder of your Mac) onto Xcode (located in the Dock). Doing so installs the Provisioning Profile onto your connected iPhone or iPod Touch. Click Continue (see Figure E-15).

Figure E-15

Figure E.15. Figure E-15

You can verify that the Provisioning Profile is installed correctly on your device by going to the Organizer application and viewing the Provisioning section (see Figure E-16).

Figure E-16

Figure E.16. Figure E-16

Back in the iPhone Developer Program Portal, you are now ready to download and install the Development Certificate onto your iPhone or iPod Touch. Click the Download Now button (see Figure E-17) to download the Development Certificate to your Mac. Click Continue.

Figure E-17

Figure E.17. Figure E-17

In the Downloads folder of your Mac, double-click the developer_identity.cer file that you have just downloaded to install it into a keychain on your Mac. When prompted (see Figure E-18), click OK.

Figure E-18

Figure E.18. Figure E-18

Back in the iPhone Developer Program Portal, it will now show you how to verify that the certificate has been installed properly in the Keychain Access application (see Figure E-19). Click Continue.

Figure E-19

Figure E.19. Figure E-19

In the Keychain Access application, select the login keychain and look for the certificate named iPhone Developer: your name (see Figure E-20). If you can see it, your certificate is installed correctly.

Figure E-20

Figure E.20. Figure E-20

You are now almost ready to deploy your iPhone application onto your iPhone or iPod Touch. Click Continue (see Figure E-21).

Figure E-21

Figure E.21. Figure E-21

Click Done to dismiss the dialog.

In Xcode, look for the Active SDK item. If this item is not already on the toolbar, choose View

Figure E-21
Figure E-22

Figure E.22. Figure E-22

Press Command-R to run the application. You are prompted for permission to access the certificate saved in your keychain. Click Allow (or Always Allow) to proceed with the signing (see Figure E-23).

Figure E-23

Figure E.23. Figure E-23

Your application will now be deployed to the device. You can see its progress in the Summary tab of the Organizer application (see Figure E-24).

Figure E-24

Figure E.24. Figure E-24

After the application is deployed onto your device, it will be launched automatically. You can capture screenshots of your device by clicking the Screenshot tab of the Organizer application (see Figure E-25).

Figure E-25

Figure E.25. Figure E-25

SUMMARY

In this appendix, you have seen the various steps required to deploy your application to your iPhone or iPod Touch. Although the number of steps may seem intimidating, it is actually quite a straightforward process. The iPhone Developer program allows you to provision up to 100 devices for testing purposes. After a device is provisioned, you can use the development certificate to deploy your applications onto it.

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

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