I have an app with Cocos2D and some UIKit mixed in. I have recently been implementing some new features so maybe the memory management is wrong or something is getting over-released but whenever I exit the app by clicking the home button, the console just crashes only with the message (lldb). Even if I turn on NSZombiesEnabled nothing different happens.
The only thing my app points to is a line that looks like this:
libGPUSupportMercury.dylib`gpus_ReturnNotPermittedKillClient:
0x38101094: trap
0x38101096: nop
I have no idea what that means but I would love to get this fixed. Does anyone have any idea why this is happening?
Thanks in advance!
Edit: I think the cause of this was because I am calling pause on Cocos2D's CCDirector after I do unscheduleAllSelectors and stopAnimation. If I don't call those 2, then there is no lldb crash.
Your app is getting killed because it's violating an exception. Almost certainly, you are using the GPU after your app has been transferred to the background, which is strictly illegal and will cause the system to send a kill signal to your app.
When an app is being run in the debugger and it's killed by an external signal (like a kill signal) rather than something the debugger can deal with (like a mach exception), the debugger just gives you whatever information it knows and traps at the program entry point (which usually causes the debugger to look like it stopped at the last line in main()
.
The important thing to note, however, is that you must end any and all GPU activity before your application enters the background. A good place to do this is in a notification handler for UIApplicationWillResignActiveNotification
or in the similarly named application delegate callback.
It probably means that you are still trying to render stuff in OpenGL (via Cocos2D) which is not allowed when the app is in background.
Turns out this was the actual fix for my issue in relation with Cocos2D: http://www.cocos2d-iphone.org/forum/topic/7326