Flash to iPhone Struggles

Adobe recently resurrected their Packager for iPhone, which takes a Flash or Air program and turns it into an iPhone app. I’ve been trying it out by converting an old game of mine. I’ve made progress, but I’ve had some struggles.

Conversion of a pure AS3 project compiled with the Flex compiler worked quite simply. After I figured out the deployment process (which I talk about below), the game just worked. It wasn’t sized to the screen, of course — 320×480 is a weird-ass resolution — but it worked.

Of course, if I want to use hardware features like the accelerometer or adjusting the screen orientation in a clever way, I can’t use a simple AS3 project. I need to turn my game into an Air app. That’s also a simple process; I can switch it over in a few minutes and have it running on my PC.

But not on my iPhone. On my iPhone, it breaks hard. There’s some sort of exception happening at startup, I think, and to debug it I’ve tried using fdb, the Flash debugger. This is my first time using a command-line debugger; in the past I’ve always used the convenient IDE debuggers, but FlashDevelop won’t receive the remote connection from the phone. Unfortunately, despite getting fdb working, it isn’t seeing the error.

So I’m reduced to the most primitive form of caveman debugging: commenting out my entire application and slowly uncommenting functions until I find the error. So far, I’ve found one problem:

The iPhone packager doesn’t seem to like dynamic classes.

That isn’t the only problem, though, and the process for this thing is a nightmare. Here’s the steps I take to debug and test:

  1. Change the code.
  2. Test on the PC.
  3. Fix any issues and retest on the PC.
  4. Run the iPhone packager, which takes about a minute.
  5. Delete the previous version of the test app from my phone.
  6. Load the new app file into iTunes and tell it to yes, replace the old app, and no, don’t apply changes to the phone
  7. Check the app as active and apply changes, then wait another minute for the phone to sync.
  8. Start FDB and tell it to listen for the iPhone.
  9. Start the app on the phone.

At this point, the app hangs and FDB tells me nothing, so I start the process over.

This is really frustrating.

On the bright side, the packager works like a charm for non-AIR apps, and I don’t need an Apple machine for it. The performance on the iPhone seems fine even with my old, embarrassing, unoptimized code, although I haven’t done any substantive tests. It’s actually really exciting to see my game running on the iPhone; the physicality of the device makes it seem much more immediate.

One thought on “Flash to iPhone Struggles

  1. If you can lay hands on a Mac of some sort, you might be able to get more debugging info out of the iPhone simulator. On the other hand, it sounds more like a problem with the Flash packager than your code itself, so a stack trace at that level might be useless.

Comments are closed.