使用沙盒游戏中心。
无论我怎么做,分数都不会出现在排行榜上。
我使用了以下代码:
- (void)scoreReported: (NSError*) error {
NSLog(@"%@",[error localizedDescription]);
}
- (void)submitScore{
if(self.currentScore > 0)
{
NSLog(@"Score: %lli submitted to leaderboard %@", self.currentScore, self.currentLeaderBoard);
[gameCenterManager reportScore: self.currentScore forCategory: self.currentLeaderBoard];
}
}scoreReported不会产生错误,但分数也不会出现在排行榜中。我知道类别是正确的,因为我在以下内容中使用了currentLeaderBoard:
- (void)showLeaderboard {
NSLog(@"leaderboard = %@", self.currentLeaderBoard);
GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
if (leaderboardController != NULL)
{
leaderboardController.category = self.currentLeaderBoard;
//leaderboardController.category = nil;
leaderboardController.timeScope = GKLeaderboardTimeScopeWeek;
leaderboardController.leaderboardDelegate = self;
[self presentModalViewController: leaderboardController animated: YES];
}
}我已经尝试了通常的2个不同的沙箱GC账号来让排行榜正常工作,甚至尝试了4个不同的GC账号,每个账号都登录到模拟器(iOS 6.1)和设备(iOS 6.0.1)上,但仍然没有joy
任何建议-或者只是沙盒游戏中心太多buggy了!(我会提出一个关于沙箱的bug,但是apple bug报告表单中有一个bug,所以也不起作用)
发布于 2013-06-07 15:57:47
游戏中心的分数报告对我来说几乎是立马就能起作用,即使是在沙盒模式下。
下面是你可以尝试的几件事
在报告分数时,请确保排行榜标识符是正确的(应与iTunesConnect)
发布于 2013-06-08 04:45:30
对于那些想知道这一点的人,我将我的submitScore方法更改为:
- (void)submitScore {
GKScore * GCscore = [[GKScore alloc] initWithCategory:self.currentLeaderBoard];
GCscore.value = [[NSUserDefaults standardUserDefaults] integerForKey:@"NEWSCORE"];
[GCscore reportScoreWithCompletionHandler:^(NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^(void) {
if (error == NULL) {
NSLog(@"Score Sent");
} else {
NSLog(@"Score Failed, %@",[error localizedDescription]);
}
});
}];
}而且它起作用了
https://stackoverflow.com/questions/16978447
复制相似问题