Tuesday, September 20, 2011

iOS Development and Programming with Flash Builder - Preparation Guide

Many people have wanted to get into iOS development to build applications for iPad, iPhone, and iPods.  Developing in Objective C is one option but this would require you to have different projects if you also wanted to create mobile applications for Android and other operating systems.  With Adobe Flash Builder 4.5.1, you can write a code base once and compile it for iOS, Android, Desktop, Adobe AIR and BlackBerry Tablet OS without substantial modifications.  This is the second in a series of articles explaining how to set up your development environment.  The previous article was for BlackBerry Tablet OS development with Flash Builder.

In this post, you will learn how to generate a digital certificate and a provisioning file, both required to install and run a mobile application on an iOS device.  If you're to attending my Adobe MAX preconference hands-on code camp and you plan on using your iOS device, you'll need the certificate and the provisioning file before you arrive.

The instructions below are geared towards Mac OS.  If you're developing on Windows or if you run into problems with the Apple Development Provisioning Assistant I recommend following the steps in Holly Schinsky's thorough guide.

1.    Navigate to the Apple developer center and apply for an account.  This will cost approximately $99 and may take up to two business days.  The URL is http://developer.apple.com/devcenter/ios/index.action

The next step is to obtain a Development Certificate. (Again the steps below are for Mac only.  If you're on Windows you'll need to use OpenSSL or something similar.)

 2.   To generate a Certificate Signing Request (CSR) with a public key, start by opening  your Applications folder, then open the Utilities folder and launch Keychain Access.

3.    Choose Keychain Access > Certificate Assistant > Request a Certificate from a Certificate Authority.

4.    In the Certificate Information window, enter or select the following information:
  • In the User Email Address field, type your email address
  • In the Common Name field, type your name
  • In the Request is group, select the Saved To Disk option
Click Continue.


5.    The Certificate Assistant saves a Certificate Signing Request (CSR) file to your Desktop.  I use a folder in the Flash Builder workspace named Apple with two subfolders, CSRs and Provisioning.
The public/private key pair will be generated when you create the Certificate Signing Request (CSR) if you use the Key Chain Assistant to create the CSR.
6.    Submit the CSR through the Provisioning Portal at https://developer.apple.com/ios/manage/overview/index.action.
After logging into the iOS Dev Center, click iOS Provisioning Portal.

7.    Click the Certificates link on the top left hand side.

 8.    Click the Development tab. 

Note: To deploy an application to a device, you need a development certificate. To deploy the application to the Apple App Store, you need a distribution certificate.  For the purposes of this session, you can use a development certificate.

9.    Click Request Certificate, and then upload the certificate request by choosing the CSR file and clicking Submit.

When the status on your certificate request is "Issued", you can move on to getting a provisioning file.

 10.  Click the Home link on the top left hand side to return to the iOS Provisioning Portal's main page.

 11.  Click Launch Assistant to start the Development Provisioning Assistant.

  12. The assistant will launch and provide an overview of the steps required to create a provisioning profile. Click Continue.
13.    When the Assistant asks you for the App ID Description, type MAX2011 and click Continue. 

  14.    Specify the device you are going to use.  (If you have previously set up a device, you can select it from a drop down list.)  

Type a description of your device (for example, John Smith iPad) and type its Unique Device ID.

Apple provides the following guidance for locating your Unique Device ID:
To locate your UDID, connect your device to your Mac and open Xcode. Navigate to the "Window" drop down menu and select "Organizer". The 40 character string in the Identifier field is your device's UDID. Copy and paste this string into the field above.

 Click Continue.
 15.    You will be prompted for a certificate.  The certificate you created earlier should be visible.  Click Continue.

 16.    On the next screen, type a Profile Description (for example, MAX2011) and then click Generate.


17.    This will generate a provisioning file named something like MAX2011.mobileprovision. Download it and save it under your Flash Builder workspace.  For convenience, I save mine under a folder to hold all Apple iOS related assets used by multiple applications.

18.  As a final step, you'll want to convert your development certificate to a P12 certificate file.  See Converting a developer certificate into a P12 file for detailed instructions on generating this file on Mac OS and Windows.

That's it...you have finished the preparations for your iOS device and Flash Builder.

To build an iOS app in Flash Builder you'll need:

  • Your iOS development certificate in P12 format
  • Your Application ID to insert in the application descriptor XML file
  • Your developer provisioning profile

If you have any problems with the steps, email me at dnickull at adobe dot com.