Built my first AIR app for iPhone

Well this past week I got my first ever smartphone, namely an Apple iPhone 4. It wasn't my first choice, I would have preferred a phone running Android, but my carrier had no such phones available...until this week of course (got to love how that works eh?).

Needless to say, after getting familiar with this iPhone, I wanted to see if I could build an app for it and after some research I found out there are several ways to do this:
  1. use XCode
  2. use HTML/JS/CSS
  3. use AS3/Flash
The first method described above is what is used in 98% of cases. You need a Mac and must have downloaded the XCode development environment and you can build an iPhone app (actually any iOS app...so it can run on iPhone/iPad/iPod) in the Objective C language.

Using the second method, you build a web application using traditional HTML/JS/CSS technologies and then compile them into a native iPhone app. There is a tool called Titanium Developer that I found that allows you to do this.

The third and final way to build an iPhone app is to use the Adobe Packager for iPhone. This little piece of technology if you remember caused a big stir back in April 2010 - cause Apple end-up changing its developer agreement and basically did not allow any third party tools, such as this one to compile any code for the iOS. Well I guess people complained and on Sept 9th, 2010, Apple changed their agreement once again, this time allowing such tools to be used. So basically I download it and build a very simple temperature conversion app (Fahrenheit to Celsius).

The Adobe Packager for iPhone allows you to take a SWF file an converted it to a native iPhone application. You can create your SWF file either by using the Flash CS5 authoring tool or by creating an AS3 project using the AIR 2.0.1 SDK in Flash Builder. In my case I built an AS3 project using Flash Builder and once the SWF was generated, I then used the iPhone packager to generate an IPA file. Then this IPA file is imported into iTunes so you can install (sync) the app onto the iPhone itself.

So its pretty cool to create your first iPhone app using AS3 and see it running. But there is a caveat. As I mentioned before, within Flash Builder you have to create an AS3 project to build the app. You can't create a regular Flex project that uses mx:Application or mx:WindowedApplication as its root class. You have to create a simple HelloWorld.as class that extends Sprite. So you can't use any of the regular controls such as mx:Label or mx:Button. Within an AS3 project you can only use the flash.text.TextField class and use that as a label, textbox and as a button where needed. So building an app in this way can be very time consuming to say the least.

Assuming that Apple doesn't change its stance once again, I'm pretty sure Adobe will be improve how we can build AIR apps for the iPhone in the very near future.

Important Note: In order to develop an app for the iPhone you first much purchase an iPhone Developer Certificate and this costs $99/year. Or you can jailbreak your iPhone :)


Air Tools said...

Excellent read. I like your style...have a good one!/Nice blog! Keep it up!

wafflejock said...

Also a fan of your style (relaxed tone is rare to find with all the fanatical bloggers out there) just wanted to say thanks. Also, with regard to developing AIR/Flex based apps for the mobile sector have you heard of Hero? Or checked out Burrito for that matter (not the kind from Chipotle, the kind from Adobe). I'm between projects at work and doing some major clean-up of repositories/workspaces/installations all over my system and just downloaded all the latest and greatest from Adobe and Google (Android SDK) so it's going to be a long night of installations but just figured if you haven't heard you might be interested in that as well.

Dimitrios "Jimmy" Gianninas said...

Thanks for the comments guys!
@wafflejock: Yes I've heard of Hero and seen the Burrito sneak peaks but I have not played with them yet. Buzy with HTML/JQuery at work and at home I need to relax :) But I will eventually get my hands on both I'm sure.

gaelleberton@mac.com said...

Do you need an IPhone to develop an IPhone app?

Dimitrios "Jimmy" Gianninas said...

@gaelleberton: no, but how else you going to test it? I really didnt look a simulator, but I'm sure if an iPhone simulator on windows exists.


hi, can you post the script code to package the .swf/.air file into a .ipa file?

Christian Johansson said...

Its actually possible to build iphone applications with mxml. I have one running on my ipod :)

Order Fluoxetine said...

Keep up the good work. general health

Anonymous said...

Keep up the good work. general health

Anonymous said...

This is good site to spent time on. allergy Read a useful article about tramadol tramadol

Learn said...

I think this high price for a iOS development license will eventually lead to Apple losing even more market share to Android. In Android, pretty much any developer can post apps on their website or send them as an email attachment (apk files) without paying a dime!