I struggling with the following Problem:
I've made a game with SpriteKit. I implemented the GameCenter
to my game. It works. Player logs in automatically and the highscore will be added to the default Leaderboard. But for example in the "EndScreen" I want to show the GameCenterLeaderboard
.
Appledocumentation tells me that I should use the following code:
- (void) showGameCenter
{
GKGameCenterViewController *gameCenterController = [[GKGameCenterViewController alloc] init];
if (gameCenterController != nil)
{
gameCenterController.gameCenterDelegate = self;
[self presentViewController: gameCenterController animated: YES completion:nil];
}
}
But presentViewController
does not work. Is there any way to switch from a SKScene
to my standard ViewController
. Or how can I show up the GameCenterleaderboard
with a button touched?
To be honest I'm pretty new to programming so this issue here might not a big problem to solve for you guys. Big big thanks for the help.