Now that AIR for iOS is back in business, I thought I’d post a quick refresher on how to get the Packager for iPhone working. I tested it yesterday with all kinds of combinations of AIR and iOS versions which have come out since we stopped working on PFI, and everything still works perfectly. It only took me about fifteen minutes to get my environment set up again, and to get iReverse compiled and running on my iPhone 3Gs. (Yes, it might finally be time to upgrade to the iPhone 4.)
If you’re ready to get started developing for iOS devices again, here’s everything you need to know:
1. Download the Packager for iPhone Project
The Packager for iPhone (PFI) project is still available on Adobe Labs, and it still works great. The first step is download and unpack it.
2. Download the Latest AIR SDK
If you’re reading this post, you probably already have the AIR SDK on your development machine, but just in case you don’t, you will need to download the latest AIR SDK (2.0.2) and unpack it.
3. Compile Your Application Into a SWF
Even though the last version of PFI was 2.0.1, and the latest version of the AIR SDK is 2.0.2, they are compatible. Compile your AIR application into a SWF using your favorite method (Flash Professional, Flash Builder, command line tools, etc.). Although it’s not the easiest approach, I use the
amxmlc command which is the Flex compiler for AIR applications. The command I run looks something like this (you will obviously need to adapt it to your environment):
/Your/Path/to/FlashBuilder/sdks/4.1.0/bin/amxmlc -sp /Path/to/Your/Project/src -el /Your/Path/to/FlashBuilder/frameworks/libs/air/airglobal.swc -o YourApplication.swf /Path/to/YourApplication.as
4. Use PFI to Build an IPA File
All you need to do now is compile your SWF into an IPA file for your iOS device. Again, you will have to adapt the following command to your specific configuration, but I use something similar to this:
pfi -package -target ipa-app-store -provisioning-profile /Path/to/Your/Provisioning/Profile -storetype pkcs12 -keystore /Path/to/Your/Certificate.p12 -storepass your_password YourApplication.ipa /Path/to/YourApplication-app.xml -C /Path/to/Your/SWF/and/Assets/Directory YourApplication.swf Default.png Icon_57.png
5. Install the Application on Your Device
To install the application on your iPhone, iPod touch, or iPad, simply drag the IPA file into iTunes and sync it with your device. You should see your application icon appear on your device’s home screen.
I recognize that this workflow is far from ideal, especially for developers who use Flash Builder. Keep in mind that what you’re seeing here represents a very low-level usage of the SDKs, and not what we were ultimately planning on releasing. However, we stopped working on PFI before our tools and frameworks could catch up and make the process much simpler.
Moving forward, that won’t be the case. Now that we are once again committed to the iOS platform, we will work on tools and frameworks to make developing iOS applications much easier. I’m currently using early versions of these projects for Android development, and they are extremely easy to use and help to create a very efficient developer workflow. Unfortunately, we’re not going to have these tools and frameworks in place for iOS development overnight, but we will have them, and we will provide developers the easiest, fastest, and most efficient path to writing multi-screen, cross-device applications.