我正在尝试为我的应用创建一个游戏中心排行榜。我一直在按照苹果公司的步骤并遵循GKTapper的示例代码,但是我无法在游戏中心显示任何得分。我已经在iTunes Connect中设置了排行榜。以下是报告分数的代码:
- (void) reportScore: (int64_t) score forCategory: (NSString *) category {
GKScore *scoreReporter = [[[GKScore alloc] initWithCategory:category] autorelease];
scoreReporter.value = score;
[scoreReporter reportScoreWithCompletionHandler:^(NSError *error) {
if (error != nil)
{
UIAlertView* alert= [[[UIAlertView alloc] initWithTitle: @"Score Report Failed!" message: [NSString stringWithFormat: @"Reason: %@", [error localizedDescription]] delegate: self cancelButtonTitle: @"Try Again..." otherButtonTitles: NULL] autorelease];
[alert show];
}
}];
}
代码似乎运行良好,没有弹出警告。但是,当我进入Game Center时,排行榜是空的。我正在运行Xcode 4.2和iOS 5。有什么想法吗?