1

为什么分数没有增加?

GKLeaderboard *lb = [[GKLeaderboard alloc] initWithPlayerIDs:@["G:1518137155"]];
  lb.category = @"top_matcher";
  [lb loadScoresWithCompletionHandler:^(NSArray *scores, NSError *error) {
     if(error == nil){
        GKScore *score = [scores lastObject];
        if(score) {
           score.value += 40;
           [score reportScoreWithCompletionHandler:^(NSError *error) {
              NSLog(@"ERR: %@ SC:%lld %@ %@ %d", error, score.value, score.playerID, score.category, scores.count);
           }];
        }
     }
  }];

我看不到输出错误

ERR:(空)SC:61 G:1689523782 top_matcher 1

4

1 回答 1

0

It's clearly documented here.

Almost all classes in Game Kit that send data to or retrieve information from Game Center expect the device to have an authenticated local player. The work those classes do is always on behalf of the local player. For example, if your game reports scores to a leaderboard, it can only report a score earned by the local player.

于 2014-06-01T09:08:27.443 回答