OpenGL ES crash on move background, iOS 5.1

ios, objective-c, opengl-es

Solution

In iOS 5.1 it is enforced that you cannot make a call to OpenGL after you have been requested to resign active.

- (void)applicationWillResignActive:(UIApplication *)application

Is the place to stop everything, whether it be a CADisplayLink or a [[CCDirector sharedDirector] stopAnimation]

Problem

I have a little issue about my application iOS. When i'm using the iOS simulator 5.1 ipad/iphone the application is working, but when i use a real iOS device (iPad and iPhone 5.1 too) the application crashes when moving on background after clicking on home button... with this error: ``` libGPUSupportMercury.dylib`gpus_ReturnNotPermittedKillClient: 0x33240094: trap 0x33240096: nop ``` I found out that it's was OpenGL ES that was still calculating and making the application crash and found this function: glFinish(); But that still not working here a sample of my code: ``` - (void)applicationDidBecomeActive:(UIApplication *)application { [[CCDirector sharedDirector] resume]; } - (void)applicationWillResignActive:(UIApplication *)application { glFinish(); [[CCDirector sharedDirector] pause]; } ``` I think the problem is just here Is there someone who have an idea of my problem ? Thanks EDIT: Problem solved with that: ``` - (void)applicationDidEnterBackground:(UIApplication *)application { [[CCDirector sharedDirector] stopAnimation]; } - (void)applicationWillEnterForeground:(UIApplication *)application { [[CCDirector sharedDirector] startAnimation]; } ``` maybe that can help someone x)

Original source