我正在嘗試使用Game Center在我的遊戲中製作排行榜。我張貼的高分,像這樣:玩家中心排行榜不顯示分數,每個用戶只能訪問他們自己的分數
GKScore *myScoreValue = [[[GKScore alloc] initWithCategory:@"grp.high_scores"] autorelease];
myScoreValue.value = self.game.scoreMeter.score;
NSLog(@"Attemping to submit score: %@", myScoreValue);
[myScoreValue reportScoreWithCompletionHandler:^(NSError *error){
if(error != nil){
NSLog(@"Score Submission Failed");
} else {
NSLog(@"Score Submitted");
id appDelegate = [[UIApplication sharedApplication] delegate];
[appDelegate displayLeaderBoard:nil];
}
}];
我看到「分數已提交」的期待,和它帶來了遊戲中心排行榜的看法,但它只是寫着「無得分」
我知道其他人有說you need at least two accounts,但我已經嘗試了三個。
對於每個帳戶,遊戲顯示爲他們在遊戲中心應用程序,當我查詢的十大得分:
- (void) retrieveTopTenScores
{
GKLeaderboard *leaderboardRequest = [[GKLeaderboard alloc] init];
if (leaderboardRequest != nil)
{
leaderboardRequest.playerScope = GKLeaderboardPlayerScopeGlobal;
leaderboardRequest.timeScope = GKLeaderboardTimeScopeAllTime;
leaderboardRequest.range = NSMakeRange(1,10);
[leaderboardRequest loadScoresWithCompletionHandler: ^(NSArray *scores, NSError *error) {
if (error != nil)
{
NSLog(@"Error grabbing top ten: %@", error);
}
if (scores != nil)
{
NSLog(@"Top ten scores: %@", scores);
}
}];
}
}
每個用戶只能看到自己的分數。
那麼爲什麼排行榜是空的,爲什麼每個用戶只看到自己的分數?