根据Guide/LeaderBoards/LeaderBoards.html
在ios7中向游戏中心报告得分应使用
[GKLeaderboard reportScores:scores withCompletionHandler:^(NSError *error) {
//Do something interesting here.
}];但是,我在GKLeaderboard中找不到对此方法的任何引用。
这里不存在该方法:Ref/Reference/Reference.html
H也不包含reportScores方法。
使用GKScore的reportScoreWithCompletionHandler方法报告分数的前一种方法已经被废弃,所以我不愿意使用这种方法。
有谁知道向ios7游戏中心报告分数的正确方法吗?
发布于 2013-10-16 03:47:31
我可以确认reportScores:withCompletionHandler: method确实有效;我正在我的一个应用程序中使用它。它位于头文件GKScore.h中。我就是这样用它的:
- (void) reportHighScore:(NSInteger) highScore {
if ([GKLocalPlayer localPlayer].isAuthenticated) {
GKScore* score = [[GKScore alloc] initWithLeaderboardIdentifier:MY_LEADERBOARD_ID];
score.value = highScore;
[GKScore reportScores:@[score] withCompletionHandler:^(NSError *error) {
if (error) {
// handle error
}
}];
}
}https://stackoverflow.com/questions/19394603
复制相似问题