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)
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]
Technically, the last method you can make OpenGL calls from is this one:
- (void)applicationDidEnterBackground:(UIApplication *)application
Although it is often a good idea to suspend drawing after applicationWillResignActive, this is just a recommendation and some apps have requirements beyond this. What is actually enforced is that you cannot make any OpenGL calls once your app moves to the background.
From the docs:
Once your application exits its applicationDidEnterBackground: method, it must not make any new OpenGL ES calls. If your application makes an OpenGL ES call, it is terminated by iOS.
Also, remember to include glFinish() as your final GL call.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With