27 June 2011
Familiarity with building RIAs using Flash Builder.
All
Note: This is an updated and expanded version of an article originally written by Andrew Shorten.
Flash Builder 4.5 includes support for packaging Flex and ActionScript applications for Google Android, Apple iOS, and BlackBerry Tablet OS devices. The process for acquiring signing certificates and provisioning application packages for the various platforms differs significantly.
This article and video aim to help ActionScript and Flex developers complete the necessary steps so that applications built in Flash Builder can be deployed to iOS devices during the development, testing and deployment phases of the project.
For more information on packaging applications for other platforms please read the following articles:
In order to package applications for testing/debugging on iOS devices and for deployment to the Apple App Store you need an Apple iOS development certificate (in P12 format) and a provisioning profile. There are both development and distribution versions of each.
The development provisioning profile is a collection of data that ties developers and devices to an authorized iOS development team and enables a device to be used for testing. It contains a set of iOS development certificates, device IDs, and an application ID and must be installed on each device on which you wish to run your application.
A distribution provisioning profile, on the other hand, may or may not contain device data depending upon if you are creating the application package for ad hoc distribution directly to specific devices or through the Apple App Store. Apple will only accept applications if they are built with an App Store distribution provisioning profile, but applications built with App Store provisioning files cannot be directly installed on a device.
The first step in acquiring the necessary certificates is to become an Apple Developer and enroll in the iOS Developer Program (fee required).
Browse to http://developer.apple.com and click the link to join the iOS Developer Program. Follow the steps to enroll in the iOS Developer Program. You will need to register as an Apple Developer (if you are not already) as an individual or as part of a company development team and then wait until you receive a verification code via email. You can then join the iOS Developer Program. In June 2011, the fee for the program was $99 per year. The entire process can take from several hours up to several days.
The iOS Provisioning Portal is where you create application IDs, register iOS devices that you wish to deploy applications to during development, upload certificate signing requests, approve and download developer certificates, and create and download provisioning profiles.
Each application (or group of applications) that you want to deploy on an iOS device must have an App ID; this is made up from a Bundle Seed ID (also called the App ID prefix) and a Bundle Identifier (also called the App ID suffix).
An App ID is the combination of a the Bundle Seed ID, a generated unique ten character string, and a Bundle Identifier. The recommended practice is to use a reverse-domain name style string for the Bundle Identifier portion of the App ID.
The Bundle Identifier you specify must match the application ID set in the AIR application descriptor file. For example, if you specify a Bundle Identifier of com.adobe.samples.FlexMobileTestDrive, the app.xml file must contain that ID (see Figure 1).
For more flexibility, you can use a wildcard in the Bundle Identifier so that it can be used for a group of applications. For example, a Bundle Indentifier of com.adobe.samples.* can be used to build and install applications with IDs of com.adobe.sample.FlexMobileTestDrive , com.adobe.samples.myOtherApp , and so on.
The devices that you want to run or debug the application on must be specified in the provisioning profile used to package the application; as such, you must register the devices on the iOS Provisioning Portal. To register a device you need its unique device ID.
Once you have the iOS device IDs, you can register them on the iOS Provisioning Portal.
Next you need to create a development developer certificate and a development provisioning profile for a specific developer certificate, App ID, and device(s). To get a developer certificate, you generate a certificate signing request (CSR) file on your computer, upload it to the iOS Provisioning Portal, and then you or a team leader approve it. Although you can create a CSR on both Mac and Windows computers, it is much simpler on Macs.
On a Mac, you use the Keychain Access program to generate a CSR.
On Windows, you can use OpenSSL to generate a CSR.
Note: You may also need to install the Visual C++ 2008 Redistributable files listed on the Open SSL download page, though you do not need to install Visual C++.
openssl genrsa -out mykey.key 2048.
Note: When using OpenSSL, do not ignore error messages. If OpenSSL generates an error message, it may still output files but those files may not be usable. If you see errors, check your syntax and run the command again.
openssl req -new -key mykey.key -out CertificateSigningRequest.certSigningRequest -subj "/emailAddress=yourAddress@example.com, CN=John Doe, C=US"
Replace the e-mail address, CN (certificate name), and C (country) values with your own.
Now you upload the certificate request file to the iOS Provisioning Portal to create a development developer certificate.
Note: If you are an individual developer or a team leader, wait until the certificate status changes from pending issuance to an Approve button (you will have to refresh the page) or until you receive an email notification that you have a certificate request requiring your approval and then click the Approve button. This usually only takes a few minutes.
If you are not an individual developer or a team leader, wait until you receive an email notifying you that a team leader has approved your certificate.
In order to use the certificate with Flash Builder, you must convert it to P12 format. The P12 file combines your Apple developer certificate and the associated private key in a single file.
On a Mac, you use the Keychain Access program to generate a P12 version.
On Windows, you use OpenSSL to convert the iOS developer certificate file into a PEM certificate file and then generate a P12 file based on the PEM certificate and the certificate key you generated earlier with the request.
openssl x509 -in developer_identity.cer -inform DER -out developer_identity.pem -outform PEM openssl pkcs12 -export -inkey mykey.key -in developer_identity.pem -out iOS_dev.p12 The final step you need to complete using the iOS Provisioning Portal before packaging your application is to create an iOS development provisioning profile.
Now that you have a development P12 developer certifcate and a development provisioning profile, you are ready to use Flash Builder to package your AIR application as a native iOS application that can be installed on one of the devices specified in the provisioning profile. You specify these files in the project's packaging info and then create a run configuration for iOS devices. Flash Builder creates an IPA application package that you add to iTunes and then sync to your device.
Recall that the application ID in the application descriptor file must match the Apple App ID associated with the provisioning file you are going to use to package the application.
Open the application descriptor file and make sure its ID is set to the same name (like com.adobe.samples.FlexMobileTestDrive) or if a wildcard bundle identifier was used (like com.adobe.samples.*), make sure the ID starts with this string.
This information will be used when debug application packages are created.
To create an application package, you create a run configuration to run on an iOS device.
You are now ready to deploy or debug the application on an iOS device. Unlike with other platforms, it is not possible for Flash Builder to automatically deploy the application to a device; you need to use Apple iTunes to complete this task.
To debug an application on a device, you use Flash Builder to create a debug IPA package and then use iTunes to install it on the device just as you did for running the application on a device. For debugging, though, your computer and the device must be on the same Wi-Fi network. The USB cable is used to install the application on the device initially with iTunes; the Wi-Fi network is used for all communication between the device and Flash Builder when the application is running and being debugged.
Note: You should uninstall the application from the device before installing a new version.
If the Flash Builder debugger times out before you finish installing and running the application on the device, just choose to debug on the iOS device again from Flash Builder and then launch the application on the device.
If you have trouble debugging on the device, check to see if you computer is on a VPN or using a firewall. If the computer is on a VPN and the device is not, you may need to take the computer off the VPN for debugging to work. If you have a firewall turned on, try disabling it. If you cannot or do not want to disable it, try opening port 7935, the port used by the Flash Builder debugger to communicate with the device.
To create a release build of your application for distribution, you must first use the iOS Provisioning Portal to create a distribution developer certificate and a distribution provisioning profile. You then use Flash Builder to create release builds using those distribution files.
You use the same process to create a distribution developer certificate as you did to create a development developer certificate in the previous Get required certificates section. The only difference is that you create it in the Distribution instead of Development tab of the iOS Provisioning Portal pages.
You also use the same process to create distribution provisioning files as you did to create a development provisioning file, but you use the Distribution tab in the Provisioning page of the in the iOS Provisioning Portal instead of Development and you use the distribution developer certificate.
Before using Flash Builder to create a release build of the application, set application properties and iOS specific settings in the application descriptor file.
iOS uses a 29-by-29–pixel icon in Spotlight search results on iPhone/iPod Touch, a 48-by-48–pixel icon in Spotlight search results on the iPad, a 57-by-57–pixel icon on iPhone/iPod Touch home screens, a 72-by-72–pixel icon on the iPad home screen, a 114-by-114–pixel icon on iPhone/iPod Touch home screen icon for the 960-by-640–pixel display, and a 512-by-512–pixel icon in iTunes.
Note: The 512-pixel PNG file is used only for testing development versions of your application. When you submit the final application to the Apple App Store, you submit the 512 image separately, as a JPG file. It is not included in the IPA.
See iOS Settings in the AIR documentation for descriptions of these settings.
When exporting for the iOS platform, use the distribution developer certificate and distribution provisioning files you created.
Note: You should uninstall the application from the device before installing a new version.
In this article, you learned to use Flash Builder and iTunes to run and debug Flex and ActionScript applications on iOS devices. You also learned how to create a release build of your application for distribution.
For more information, refer to the following resources:
Documentation: Developing Mobile Applications with Flex and Flash Builder
Documentation: Building Adobe AIR Applications
Documentation: Developing AIR applications for mobile devices
Websites

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License
Tutorials and samples |
AIR blogs |
More |
| 02/15/2012 | Friday Demo/Q&A: Mission Mobile |
|---|---|
| 02/13/2012 | In Europe to discuss Flash Roadmap |
| 02/11/2012 | Download Flash Player Incubator preview |
| 02/02/2012 | AIRKinect Extension is a Native Extension for use with Adobe AIR... |
AIR Cookbooks |
More |