I have a Cocos2D project that does a lot of data loading via ASIHTTPRequest. The request often has a completion block attached, which could trigger Cocos2D to do something like load up a texture for displaying a game element.
My problem is that it seems the completion block can be called when the application is moved to the background. That triggers an OpenGL call resulting in application termination with the error: gpus_ReturnNotPermittedKillClient
The Cocos2D director is being told to pause and stopAnimation before moving to the background. So it seems that those functions have no effect on a block that is yet to run (I wouldn't expect it to), nor does this seem to prevent calls to other Cocos2D functions, like [CCRenderTexture renderTextureWitWidth:andHeight:] to load up a texture.
Given this situation, is there a recommended way to safely pause a game as described?