排行榜得分未显示UP

时间:2011-11-28 22:22:19

标签: ios xcode leaderboard

我创建了一个小应用程序只是为了测试游戏中心我登录我能够提高分数但是当我看着领导板什么都没有

这是我的代码

- (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");

    }

}];

}

1 个答案:

答案 0 :(得分:1)

当排行榜上有两个或更多玩家时,GameCenter将仅显示排行榜得分。

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