Domanda

I'm trying to enable Game Center Leaderboard to my iPad game and I have learned that you need to post more than one score to a leaderboard for the scores to show in the default leaderboard UI.

I have two separete accounts that I used to post two different scores to the same leaderboard, but when I call loadScoresWithCompletionHandler I only get one score back (the score for the user I currently are logged in with).

Any ideas why?

GKLeaderboard *myLB = [[GKLeaderboard alloc] init];

myLB.category = @"MyLeaderboardId";
myLB.timeScope = GKLeaderboardTimeScopeAllTime;
myLB.playerScope = GKLeaderboardPlayerScopeGlobal;
myLB.range = NSMakeRange(1, 100);

[myLB loadScoresWithCompletionHandler:^(NSArray *scores, NSError *error) {
    if (error != nil)
    {
         NSLog(@"%@", [error localizedDescription]); 
    }

    if (scores != nil)
    {
        for (GKScore *score in scores)
        {
            NSLog(@"%lld", score.value);
        }
    }
}];
È stato utile?

Soluzione

It works fine for me. Just add scores under another account.

I've got:

scores (
"<GKScore: 0x960e3e0><0x960e3e0> player=G:1208389607 rank=1 date=2012-01-19 12:56:47 +0000 value=27 formattedValue=27 context=(null)",
"<GKScore: 0x96a1bc0><0x96a1bc0> player=G:1176161436 rank=2 date=2012-01-19 08:35:06 +0000 value=16 formattedValue=16 context=(null)"

)

And center by standard controller show same results.

thanks,

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top