I’d already optimized my new Flash game Word Up Dog to run on mobile phones, and used Air to package a version that I could sell in the Android app store. Now for the next challenge: the iPhone.
Shortly after Adobe announced the tools for compiling Flash code into iOS apps, Apple banned the process as part of their ongoing spat with Adobe. Happily they retracted this bit of bs six months later, so we are free to experiment with Air for iOS once more. God knows if we’ll ever view Flash websites on an iPad browser, but this is a start.
Building Air for the iPhone is similar to the Android process, but generating the security certificate requires paying Apple $99 for a developer license (Android is free), then dancing back and forth uploading and downloading files from their website. Although you need a Mac to write iOS apps in Objective-C, you can compile Flash AS3 code into iOS using Mac, Windows, or Linux. I used Windows, along with OpenSSL (instead of Keychain) to generate the security bits, and iTunes (instead of Xcode) to install the app onto my phone.
Here are the steps:
- Download the Air 2.6 SDK, paste it into a copy of your Flex SDK directory, and set FlashDevelop to compile using the result
- Download OpenSSL
- Start a new FlashDevelop AIR AS3 project
- AddChild your existing game in Main.as
- Add NativeApplication handlers to prevent the phone from idling
- Modify your application.xml to add iPhone-specific settings
- Sign up for a $99 iOS developer account
- Generate a key by calling
openssl genrsa -out SarahNorthway.key 2048
- Generate a certificate signing request with
openssl req -new -key SarahNorthway.key -out WordDog.certSigningRequest -subj “/emailAddressfirstname.lastname@example.org, CN=Your Name, C=US”
- On the Apple website, upload WordDog.certSigningRequest, create a provisioning profile for your iPhone and download WordDog.mobileprovision and developer_identity.cer
- Generate a pem file with
openssl x509 -in developer_identity.cer -inform DER -out developer_identity.pem -outform PEM
- Generate the p12 certificate with
openssl pkcs12 -export -inkey SarahNorthway.key -in developer_identity.pem -out WordDog.p12 -passout pass:yourpass
- Build your air project to create WordDog.swf
- Compile the final ipa file using
adt -package -target ipa-app-store -provisioning-profile WordDog.mobileprovision -storetype pkcs12 -keystore WordDog.p12 -storepass yourpass WordDog.ipa application.xml -C . WordDog.swf Default.png iconsFolder (this takes a few minutes)
- In iTunes, drag WordDog.mobileprovision and WordDog.ipa into the library
- Find your game in the iTunes library apps, drag it onto your phone and sync
Wheuf! A few extra steps and security files in there, but it’s all worth it, so we can sleep safe knowing nobody is installing homebrew apps on their own iPhones without paying Apple first.
Unfortunately Air 2.6 only supports iPhone gen 3 and above, but this is probably for the best considering how much more processor intentive the Flash code seems to be compared to Objective-C code. Word Up Dog runs well on a 2nd gen iPad, but it still drops to 15 fps when moving the map around, so I’m going to have to go back to optimization before I can release it on the app store.
5 thoughts on “Word Up Dog: Creating iPhone apps on Windows with Adobe Air”
Neat to read that someone is going through the exact same process as I am right now: I havn’t gone as far as to deploy to an iOS device, yet. I already got stuck running my game on Android, since the frame rate drops below 20 a lot despite all the optimizations I’ve made. I guess I have no choice but to use blitting after all. Good bye MovieClips…
Anyways, thanks for sharing all this information once again, it’ll sure help me once I get to tackle iOS deployments.
And on another note: I havn’t followed blogs a lot in recent years (probably cause they were the wrong ones) but your cooperative blog sure is one of the most exciting ones to follow these days. Keep up the good work!
Thanks so much for such an informative post. I’ve been struggling with exactly this process for a while now and had given up. Signing apps is always a giant pain, and being an open source windows dev much of what I find only is Mac-centric.
The good news is that if you wait for Flash 11 (MOLEHILL) all the rendering can be done on the 3d hardware using openGL so drawing performance will not be an issue in the slightest since Molehill for AIR (running with unbelievable speed on mobile devices) is already in beta. Don’t waste too much time optimizing using old fashioned bitmapdata etc as it will all be obsolete by winter and you’ll instead want to use textured quads in “3d”.
Much appreciated, and keep up the great work!
Woah! I’m really loving the template/theme of this website. It’s simple, yet effective.
A lot of times it’s tough to get that “perfect balance” between usability and visual appeal. I must say you’ve done a very good job with this.
In addition, the blog loads super quick for me on Opera.
I’m gone to say to my little brother, that he should also visit this webpage on regular basis to obtain updated from hottest gossip.
Good day! I know this is kinda off topic but I was wondering which blog platform are you using for this website?
I’m getting fed up of WordPress because I’ve had issues with hackers and I’m looking at alternatives for another platform. I would be great if you could point me in the direction of a good platform.