UIApplicationExitsOnSuspend, iOS6 and all that

back in the day i just used to add UIApplicationExitsOnSuspend to my plist and opt out of multitasking.

However, now when i opt out of operating in background, iOS6 likes to pause me - for example when i press the sleep button. When i press again to wake, i’m greeted with a red status “recording” bar. Clearly, i’m not doing any recording!

First of all, in Juce, we’re not handling this state at all. I added hooks to

  • (void) applicationDidBecomeActive: (UIApplication*) application;
  • (void) applicationWillResignActive: (UIApplication*) application;

forwarding these to my application. I suspended my threads accordingly, but this didn’t fix the red bar. I’m assuming iOS knows that there’s stuff still going on which is causing the red bar. Perhaps the other internal Juce threads should also be paused. That would involve considerable Juce hacking.

I figured out the reason why my app quits when i don’t opt out of background, but does not quit when i do is down to the size of the app. Presumably, when i do not disallow background, iOS decides i’m too fat for background and quits me. When i disallow background, instead it pauses me for short things, and quits me for others (eg pressing home always quits).

To fix this problem, i’m now not setting UIApplicationExitsOnSuspend, but manually quitting on applicationDidEnterBackground, which is forward by Juce as “suspended”.

It’s still not 100% ideal, but i know that i don’t get to run in background anyhow and requesting this mode makes things worse.

comments and suggestions welcome.