We are working on an app (Starling 1.7, Feathers 2.3, AIR 21) which changes orientation from portrait to landscape in one section, then returns to portrait when the user has completed that section. We are getting a crash on iOS 9 when forcing an orientation change, and I'm at a loss for what the issue is or how to resolve it. When I say crash I mean the app closes instantly and returns to the home screen.
We are forcing the orientation change:
trace("Changing orientation to " + targetOrientation);
This causes crashes in different scenarios: it always causes a crash on the iPhone 4s with a test build (unless profiling with Scout, in which case crash seems to be 50/50), but very rarely with a debug build. It rarely causes a crash on the iPad Air 2 with a test build, and rarely or never with a debug build. Because the crash rarely happens in debug mode, it has been difficult to try and diagnose it; when it does occur in debug mode there is no error message, it just closes after the "Changing orientation" trace above.
The iOS crash logs show this error:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000004
I've put a lot of time into this, testing different scenarios and reducing the overall memory usage of the app. I've tried removing all graphics from the stage when the orientation change occurs, so that there is nothing onscreen but an empty Feathers screen, but that doesn't help. I've optimized our memory and texture usage but that didn't help either. Scout shows that we are using about 28 megabytes of AS3 memory and 27 megabytes of GPU memory on the iPhone 4s; I don't know if that is unusually high, but since using debug builds or having the Scout profiler open greatly reduces the frequency of crashes, it seems like the crash is being caused by speed rather than memory. Memory usage does not spike when the orientation change occurs.
I just don't know what the problem could be; I'm not sure if it's actually related to Starling or Feathers, or is a problem with AIR 21 or an ANE we are using or something else. Any advice or tips on what might be causing this issue, or how to diagnose it, would be greatly appreciated.