I've been developing a mobile app for the past several weeks. Yesterday, I tried to add an ANE to the app- with a native code implementation for iOS and a pure-ActionScript (default) implementation for Android and the simulator. After poking around the internet for some time looking for good examples of how to do this- I got it working. At least, it worked on both Android and the simulator. However, when I try to run the app on an iOS device- using either the "fast" packaging or the slower "export for release" packaging- the app launches to an empty/black screen. If I'm attempting to launch in debug mode, it does not even connect to the debugger.
I've been searching for possible causes for this for several hours now but I haven't turned up anything. Has anyone in the community encountered this? Do you have any advice?
In your projects settings->ActionScript Build Packaging->Apple IOS->Native Extensions tab is the checkmark next to your ANE checked? Sometimes that isn't checked and it isn't packaged. I don't know why but I've seen that happen before.
So you have the basics established.. The SWC is included, the ANE is added, you get the green checkbox and are packaging it. When you roll-down the ANE from the ANE tab it states the OS it is designed for and that meets your criteria? e.g. Not using one made for OS5.1 and your device is not OS5.1.
I've had a lot of bad ANEs, outdated, etc. Some put me in an eternal compile loop at 57% progress and never make an IPA. I sometimes have to take an ANE out, compile and test, then re-add it just to make sure that's the issue. Have you done that?
Update: Downloaded the AIR 3.2 SDK and re-built my app. Now the app shows it splash screen but insta-crashes once my code tries to use the ANE. Crash log shows:
May 2 13:44:41 Labs-iPad-3 MyAppName <Error>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Cannot create an NSPersistentStoreCoordinator with a nil model'
*** First throw call stack:
(0x3395588f 0x32447259 0x347f6491 0x775d 0x786b 0x75bd 0x6de9 0x7047 0x6253 0x81577b 0x815ce7 0x5a3fe4 0x5a4228 0x348cac 0x6dc640 0x6dc0d4 0x6dd1c0 0x6db5bc 0x6730c8 0x6dbf38 0x6db5bc 0x6730c8 0x6dbf38 0x664c00 0x6db338 0x677334 0x6dd01c 0x6db5bc 0x6730c8 0x6dbf38 0x69cb90 0x69cc00 0x67817c 0x6dbf38 0x69cb90 0x69cc00 0x67817c 0x6dbf38 0x6db588 0x6730c8 0x6dbf38 0x6db588 0x6730c8 0x6dbf38 0x306d84 0x3084b8 0x34cf90 0x6dc640 0x6dc0d4 0x6dd1c0 0x6db5bc 0x6730c8 0x6dbf38 0x6db5bc 0x6730c8 0x6dbf38 0x306d84 0x2fa108 0x2fa188 0x300870 0x43e8e8 0x43fbb8 0x4dc3a4 0x4dc4b8 0x14ae44 0x3b6f0 0x338b41fb 0x328d6747 0x33929ad3 0x3392929f 0x33928045 0x338ab4a5 0x338ab36d 0x32e29439 0x355a0e7d 0x19314c 0x815648)
May 2 13:44:41 Labs-iPad-3 ReportCrash <Notice>: Formulating crash report for process MyAppName
May 2 13:44:41 Labs-iPad-3 com.apple.launchd (UIKitApplication:my.package.name.MyAppName[0xe6d3]) <Warning>: (UIKitApplication:
my.package.name.MyAppName[0xe6d3]) Job appears to have crashed: Abort trap: 6
May 2 13:44:41 Labs-iPad-3 SpringBoard <Warning>: Application 'MyAppName-debug' exited abnormally with signal 6: Abort trap: 6
May 2 13:44:41 Labs-iPad-3 ReportCrash <Notice>: Saved crashreport to /var/mobile/Library/Logs/CrashReporter/MyAppName_2012-05-02-134441_Labs-iPad-3.plist using uid: 0 gid: 0, synthetic_euid: 501 egid: 0
Me following these random stack traces on really simple code is like a cat chasing a flashlight. Good luck with it, I hope the debugger works better for you than for me. I still get EXC_BAD_ACCESS even when using just NSLog() haha..
For some bizarre reason, I'm now back to the solid black screen when I launch my app. AIR 3.2 SDK had fixed that but then a few launches later, it's back. No idea why.
I think the cat chasing the flashlight is a good analogy.
The XCode debugger is great for analyzing apps made inside XCode but something is fishy with the IPAs exported from ADT. I'm having issues getting instruments to make much sense of the garbled object names AIR is cross compiling to. It's not like XCode itself which will zombie your objects and point out you tried to deallocate "this object" and here's the zombie to prove it. So far I can't even get Zombies enabled and the objects AIR is creating are all random named so it's a huge PITA so far to debug.
Update: I see a bit more of a pattern here. This thread and one of my other threads appear to be related.
Here's a little more info as to my setup. This is an over-simplified view of my build process but I think it touches on all of the related issues. My mobile project consists of an AIR project and several Flex Library projects.
If I set project B's linkage to Project A as "Merged into code" and Project C's linkage to Project A as "External", I am able to build Project C (using either the fast build or the slower "Export Release Build") but when I attempt to launch the resulting IPA on an iOS device, all I see is a blank/black screen. If I'm attempting to debug the app, no connection to the debugger is made.
If I set project B's linkage to Project A as "External" and Project C's linkage to Project A as "Merged into code" then I am able to build Project C using the fast-build option and my app runs fine (though slow) on an iOS device. If I try to use the "Export Release Build" option though, my export fails with a Java Exception in thread "main" java.lang.Error: Unable to find named traits.
So it seems like... no matter what I do, I can't export a working, optimized app.