That's not the director that needs to be dismissed, but the GKGameCenterViewController
that you receive by parameter in the function -(void)gameCenterViewControllerDidFinish
. You should do this :
- (void) gameCenterViewControllerDidFinish:(GKGameCenterViewController *)gameCenterViewController{
[gameCenterViewController dismissViewControllerAnimated:YES completion:nil];
}
EDIT : You also have to set the delegate of your controller to your current scene and implement <GKGameCenterControllerDelegate>
in the .h file of your class :
//In your .h file
@interface foo : CCScene <GKGameCenterControllerDelegate>{
}
//In you .m file
GKGameCenterViewController *gameCenterController = [[GKGameCenterViewController alloc] init];
if (gameCenterController != NULL)
{
gameCenterController.gameCenterDelegate = self;
[[CCDirector sharedDirector]presentViewController:gameCenterController animated:YES completion:nil];
}