Question

I'm building an iOS and Android application using Adobe AIR. It loads in a number of packaged assets (swf's, audio) from a directory that's packaged into the app at compile time. I'm building using IntelliJ IDEA and the latest AIR SDK (13.0.0.83). I'm signing using an Enterprise cert, and using HockeyApp to distribute. Everything works fine, apart from a single issue:

When I debug over USB to an iOS device, my packaged assets work correctly (images are displayed, audio plays, no errors).

However: when I package the iOS app up and deploy it via HockeyApp, my images don't play and I get no audio. What's weird is, there are no errors when I load in the packaged assets - I have a debug readout on my app, and this reports that the files are being found correctly. I put some deliberately incorrect filenames in as a test, and got an error as expected, suggesting the app IS finding the files - it just isn't displaying the loaded swfs. Additionally if I break open the .ipa I can see everything in the correct place.

EDIT - forgot to add, I've noticed that if I take the .ipa that gets built when deploying to the device, and deploy THAT via HockeyApp, everything works OK. The only difference I can see is that this one is a debug version, so it tried to connect to a debugger.

I'm not sure what's actually happening in my app, can anyone shed any light on it?

Any help appreciated.

Was it helpful?

Solution

You are running into an issue with how things are compiled for debug compared to how they compile for release.

In debug, AIR is installed alongside the app. Your code is actually running as AS3 in the AIR runtime, which is essentially a virtual machine for Flash in this instance.

In release, the compiler cross-compiles your code from AS3 to Objective-C. Apple does not allow virtualized languages to be used on iOS, so this is necessary. This is why it takes so much longer to compile a release build compared to a debug build.

The issue you are likely facing is that you cannot load code from external sources. All code must be in the app when compiled and not in any external resources (even an embedded SWF won't work). So any code within your SWFs (also known as ABC code) will fail to execute and will, in most cases, prevent the SWF from even loading. Additionally, there are still a few bugs with loading in multiple SWFs into AIR for iOS. Sometimes they simply do not work.

If these SWFs have any code in them whatsoever, it must be removed. Even if you could get it to work, Apple would pull your app immediately when they got wind of what you were doing (assuming they didn't catch it during review, which they would). If the SWFs are just assets, I suggest breaking them down into MP3 and PNG/JPG files and running the code within your app, rather than the SWFs. Use the [Embed] meta tags to embed the files.

For the most part, you should avoid using SWFs in AIR. There are ways to make them work all right, but it is, in my opinion, just not worth the time, especially since they are very difficult to manage later on.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top