26
votes

I'm developing a Game Center enabled game and I'm running into an issue in the sandbox environment. I can successfully report the score without error. However, when I show the leaderboard, there are no scores visible. To verify that the score actually got there, I query the local user's score with the following code:

-(void)retrieveLocalScoreForCategory:(NSString *)category
{
    GKLeaderboard *leaderboardRequest = [[GKLeaderboard alloc] init];
    leaderboardRequest.category = category;

    [leaderboardRequest loadScoresWithCompletionHandler: ^(NSArray *scores,NSError *error) 
     {
         [self callDelegateOnMainThread: @selector(localPlayerScore:error:) withArg: leaderboardRequest.localPlayerScore error: error];
     }];
}

In my delegate I log the score to the console and I can see the correct score got there. I have already verified that I'm showing the leaderboard using the correct leaderboard category id (I only have one).

Does anyone know why my score isn't visible on the leaderboard in the sandbox environment immediately? Is there a delay before the score shows up?

2

2 Answers

56
votes

I ran into the same issue with projects I've worked on.

The GC Leaderboards (Sandbox/live) will only return scores if there are two or more players on the Leaderboards.

So make sure you either submit the score with 2 different accounts on one 1 device or 2 different accounts on separate devices.

3
votes

Try changing timeScope.

Sometimes GKLeaderboardTimeScopeAllTime & GKLeaderboardTimeScopeToday returns nothing but GKLeaderboardTimeScopeWeek works fine. I think it's a GC sandbox server problem.

Hear us Apple: use some of those billions to make your web services better.