Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Game Center Sandbox: Leaderboards show "No score"

So I am sending scores to the GC leaderboards, I receive no errors and the scores apprently send but I still see no scores listed in the leaderboards! The leaderboard itself is listed in Game Center there are just no scores.

According to a Google search and a question on here this could be resolved by attempting to log scores with more than one account. I have tried on three different accounts now both in Simulator (iOS5) and on my iPhone; none of them show any errors when submitting the scores.

The code that sends the score is here:

- (void)reportScore:(NSString *)identifier score:(int)rawScore {

    GKScore *score = [[[GKScore alloc] initWithCategory:identifier] autorelease];
    score.value = rawScore;
    [scoresToReport addObject:score];
    [self save]; // Save here even though we save again in didEnterBackground, just in case of crash...

    if (!gameCenterAvailable || !userAuthenticated) return;
    [self sendScore:score];
}

- (void)sendScore:(GKScore *)score {
    [score reportScoreWithCompletionHandler:^(NSError *error) {
        dispatch_async(dispatch_get_main_queue(), ^(void)
                       {
                           if (error == NULL) {
                               NSLog(@"Successfully sent score!");
                               [scoresToReport removeObject:score];                
                           } else {
                               NSLog(@"Score failed to send... will try again later.  Reason: %@", error.localizedDescription);                
                           }
                       });
    }];
}
like image 619
Chris Avatar asked Dec 27 '22 06:12

Chris


1 Answers

It suddenly started working (without any code change or even a recompile). I figure it takes a while for the leaderboards to actually appear, for me about 18 hours.

Scores submitted within this time will still record, they just wont be visible instantly.

like image 56
Chris Avatar answered Jan 11 '23 20:01

Chris