cocos2d-iphonedictation

Cocos2d crash when using dictation (microphone button) with CCTextField


I get a permanent crash when tapping on microphone button during the input in CCTextField. There's no crash on iPhone 4s iOS8, but the game is crashed on iPhone 5s iOS9 and iPhone 6+ iOS9. This issue seems to be the same as described here http://discuss.cocos2d-x.org/t/engine-crash-on-ios7/9129/10 and there's a solution for cocos2d-x there. Can someone provide a solution for cocos2d-objc ?


Solution

  • Okay, here's the workaround for cocos2d-objc:

    - (void) update:(CCTime)delta{
        CCGLView *ccglView = (CCGLView *)[[CCDirector sharedDirector] view];
        [EAGLContext setCurrentContext:ccglView.context];
    }