Cocos2d与GameCenter,OpenGLError

时间:2011-09-26 12:53:30

标签: iphone opengl-es cocos2d-iphone game-center

我在特定情况下遇到此错误,我不知道如何解决它。

在我邀请某人和我一起玩之后,我触摸'uninvite'按钮然后我点击了取消并且它调用了这个方法:

    // The user has cancelled matchmaking
- (void)matchmakerViewControllerWasCancelled:(GKMatchmakerViewController *)viewController {    
    [self.presentingViewController dismissModalViewControllerAnimated:YES];
    NSLog(@"User cancelled the invitation.");    
}

之后发生了这个错误:

OpenGL错误0x0506 in - [EAGLView swapBuffers]

一遍又一遍。

如果我不邀请某人并且只是点击取消,它会再次调用该方法,但它会正确返回游戏界面。以前有人见过这样的东西吗?在我驳回视图之前,我是否必须停止邀请?

2 个答案:

答案 0 :(得分:2)

我有类似的问题并修复了它。很难找到解决方案。

我必须像这样在AppDelegate中更改我的init方法:

- (void) applicationDidFinishLaunching:(UIApplication*)application
{
    CC_DIRECTOR_INIT();
    // Obtain the shared director in order to...
    CCDirector *director = [CCDirector sharedDirector];
    // Sets landscape mode
    [director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];

    if( ! [director enableRetinaDisplay:YES] )
        CCLOG(@"Retina Display Not supported");
    [[CCDirector sharedDirector] runWithScene: [MainMenuLayer scene]];
    [[CCDirector sharedDirector] setDisplayFPS:NO]; 
    [self authenticateLocalPlayer];
}

关闭:

-(void)achievementViewControllerDidFinish:(GKAchievementViewController *)viewController{
     [tempController dismissModalViewControllerAnimated:YES];
        [tempController.view removeFromSuperview];
     [[CCDirector sharedDirector] resume];
}

答案 1 :(得分:0)

不确定这是否有帮助,但可能会在显示Game Center UI之前暂停CCDirector,并在完成所有Game Center操作后恢复它。