[Solved][iOS] OpenGL error after finishing image picking

Hello,

Since upgrading to XCode 6 (probably linked to the new SDK), I have an OpenGL error when finishing image picking.

After resuming, [CCES2Renderer resizeFromLayer:] is called (from [CCEAGLView layoutSubviews]), and there are the logs:

failed to call context
cocos2d: surface size: 0x0
Failed to make complete framebuffer object 0x8CD6
OpenGL error 0x0506 in -[CCEAGLView swapBuffers] 322
failed to call context
cocos2d: surface size: 0x0
Failed to make complete framebuffer object 0x8CD6
OpenGL error 0x0506 in -[CCEAGLView swapBuffers] 322
OpenGL error 0x0506 in -[CCEAGLView swapBuffers] 322

And then it keeps spamming that last line, but doesn’t crash: the screen stays frozen.

It happens on an iPhone 5C running iOS 8.1.2, but does not happen on an iPad Air running 8.1.2 too.

Does anyone know how to fix that problem ?

Code for the ImagePicker is from https://github.com/FenneX/FenneX
The error can be reproduced with https://github.com/FenneX/FenneXTestProject Run the project, try to take an image from gallery or camera, the app freeze when you get back.

Up, I get the exact same problem testing on an iPhone 6.

I am really desperate to find a solution.

I finally found the solution, thanks to this old SO post: http://stackoverflow.com/questions/9900007/ios-5-cocos2d-and-uikit-push-and-pop-uiview-causing-failed-to-call-context

It seems when you show another UIView in the app, you must use Director::stopAnimation, and then Director::startAnimation when you discard the UIView.

Fix on FenneX: https://github.com/FenneX/FenneX/commit/aa5587bf698518f3f820bbd838733cb10148704c

Note: pause/resume didn’t work for me.

Thank You Sir!

I have similar problem, when popping in app sheet the open gl error will occur also for iPhone devices.
Now it’s fixed.