Question

Using the sandboxed Gamecenter.

No matter what I do the scores never appear in a leaderboard.

I am using the following code:

- (void)scoreReported: (NSError*) error {
    NSLog(@"%@",[error localizedDescription]);
}

- (void)submitScore{

    if(self.currentScore > 0)
    {
        NSLog(@"Score: %lli submitted to leaderboard %@", self.currentScore, self.currentLeaderBoard);
        [gameCenterManager reportScore: self.currentScore forCategory: self.currentLeaderBoard];
    }
}

And scoreReported doesnt produce an error, yet the score doesnt appear in the leaderboard. I know the category is correct as I use currentLeaderBoard in:

- (void)showLeaderboard {
    NSLog(@"leaderboard = %@", self.currentLeaderBoard);
    GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
    if (leaderboardController != NULL)
    {
        leaderboardController.category = self.currentLeaderBoard;
        //leaderboardController.category = nil;
        leaderboardController.timeScope = GKLeaderboardTimeScopeWeek;
        leaderboardController.leaderboardDelegate = self;
        [self presentModalViewController: leaderboardController animated: YES];
    }
}

I have tried the usual 2 different sandbox GC accounts to get the leaderboard working Even tried 4 different GC accounts each logging in on both the simulator (iOS 6.1) and device (iOS 6.0.1) Yet still no joy

any suggestions - or is it just that the sandboxed gamecenter is far too buggy!!! (I would raise a bug about sandbox but the apple bug reporting form has a bug in it so that doesnt work either)

Was it helpful?

Solution

Score reporting to Game Center works almost immediately for me, even in sandbox mode.

Here are the few things you can try

  1. Make sure the the Leaderboard identifiers are correct when reporting scores (Should exactly match with "Leaderboard ID"s in iTunesConnect)
  2. Try Deleting the test data under "Manage Game Center" section of iTunesConnect
  3. Delete the application, launch "Game Center" application in your device and goto "Games" tab and remove your app. Reinstall the app and try reporting the score again.
  4. Make sure [gkScore reportScoreWithCompletionHandler:^(NSError *error) doesn't return any error

OTHER TIPS

For those who want to know this what I changed my submitScore method to:

 - (void)submitScore {
    GKScore * GCscore = [[GKScore alloc] initWithCategory:self.currentLeaderBoard];
    GCscore.value = [[NSUserDefaults standardUserDefaults] integerForKey:@"NEWSCORE"];
    [GCscore reportScoreWithCompletionHandler:^(NSError *error) {
        dispatch_async(dispatch_get_main_queue(), ^(void) {
            if (error == NULL) {
                NSLog(@"Score Sent");
            } else {
                NSLog(@"Score Failed, %@",[error localizedDescription]);
            }
        });
    }];
  }

and it worked

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top