1

I try to show the leaderboard for my game with Game Center. When I click on the Game Center Button in my game the following is called:

- (void)showGameCenterButtonPressed:(id)sender {
{
    if ([GKLocalPlayer localPlayer].authenticated == NO) {
        UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"You must enable Game Center!"
                                                          message:@"Sign in through the Game Center app to enable all features"
                                                         delegate:nil
                                                cancelButtonTitle:@"OK"
                                                otherButtonTitles:nil];
        [message show];
    } else {
        GKGameCenterViewController *gameCenterController = [[GKGameCenterViewController alloc] init];
        if (gameCenterController != nil)
        {
            gameCenterController.gameCenterDelegate = self;
            gameCenterController.viewState = GKGameCenterViewControllerStateLeaderboards;
            gameCenterController.leaderboardIdentifier = @"MyScore";
            UIViewController *vc = self.view.window.rootViewController;
            [vc presentViewController: gameCenterController animated: YES completion:nil];
        }
    }
}

}

I also have a report Score method:

-(void)reportScore {
if ([GKLocalPlayer localPlayer].isAuthenticated) {
    GKScore *scoreReporter = [[GKScore alloc]  initWithLeaderboardIdentifier:@"MyScore"      forPlayer:[GKLocalPlayer localPlayer].playerID];
    scoreReporter.value = _highScore;
    NSLog(@"Score reporter value: %@", scoreReporter);
    [GKScore reportScores:@[scoreReporter] withCompletionHandler:^(NSError *error) {
        if (error != nil) {
            NSLog(@"Error");
            // handle the reporting error
        }

    }];
}

}

Now the Game Center window slides up, shows the gametitle, but says "No leaderboards"

I thought this might be an iTunes Connect issue.. The Bundle Identifier is correct though and Game Center is enabled. Any idea on that? Thanks so much!

4
  • Did you create a corresponding leaderboard in iTunes Connect?
    – CodeSmile
    May 28, 2014 at 13:52
  • 1
    I created a leaderboard in the "Manage Game Center" Section. Can you confirm that there must be an iTunes Connect Problem rather than in my methods?
    – Elio_
    May 28, 2014 at 13:58
  • 1
    @user3488081, you got solution for this problem ? for me also something happened
    – Guru
    Jun 7, 2014 at 16:03
  • Any solution?? everything is working in sandbox mode though Jan 1, 2015 at 16:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.