0

我创建了一个小应用程序只是为了测试游戏中心我登录我可以提高分数但是当我查看排行榜时什么都没有

这是我的代码

- (IBAction)increaseScore:(id)sender {

currentScore+=4;
scoreLabel.text=[NSString stringWithFormat:@"%i",currentScore];
}

- (IBAction)showLeaderBoard:(id)sender {

GKLeaderboardViewController *leaderBoardController = [[GKLeaderboardViewController    alloc]init];
leaderBoardController.category=@"1";
leaderBoardController.timeScope=GKLeaderboardTimeScopeAllTime;
leaderBoardController.leaderboardDelegate=self;

[self presentModalViewController:leaderBoardController animated:YES];

}
- (void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController
{
[self dismissModalViewControllerAnimated:YES];

}


- (IBAction)sumbitScore:(id)sender {

GKScore *scoreReporter = [[GKScore alloc]initWithCategory:@"1"];
//@"1" is the leaderboard ID
scoreReporter.value=currentScore;
[scoreReporter reportScoreWithCompletionHandler:^(NSError *error) {
    if (error) {
        NSLog(@"submit failed");
    }else{

        NSLog(@"access granted");

    }

}];

}
4

1 回答 1

1

GameCenter 仅在排行榜上有两个或更多玩家时才会显示排行榜分数。

您将需要另一个 GameCenter 帐户提交的分数。您可以注册第二个 Apple Id,以便能够从“第二个”玩家发送分数。

于 2012-02-09T06:14:44.103 回答