0
我創建了一個小應用程序只是爲了測試出遊戲中心我登錄,我能夠增加得分,但是當我看領先榜無所不有排行榜分數沒有顯示出來
這裏是我的代碼
- (IBAction)increaseScore:(id)sender {
currentScore+=4;
scoreLabel.text=[NSString stringWithFormat:@"%i",currentScore];
}
- (IBAction)showLeaderBoard:(id)sender {
GKLeaderboardViewController *leaderBoardController = [[GKLeaderboardViewController alloc]init];
[email protected]"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");
}
}];
}
而且我正在獲取@「授予訪問權限」而不是錯誤 – ifrapps