iOS 7 - 游戏中心排行榜集成

时间:2013-11-04 07:27:39

标签: ios game-center

- (void) reportScore: (int64_t) score forLeaderboardID: (NSString*) identifier
{
    GKScore *scoreReporter = [[GKScore alloc] initWithLeaderboardIdentifier: identifier];
    scoreReporter.value = score;
    scoreReporter.context = 0;

    NSArray *scores = @[scoreReporter];
    [GKLeaderboard reportScores:scores withCompletionHandler:^(NSError *error) {
    //Do something interesting here.
    }];
}

https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/GameKit_Guide/LeaderBoards/LeaderBoards.html

在上面的网站上,我使用了上面的代码(标题是向游戏中心报告得分(iOS 7))但是在GKLeaderboard reportScores ...行上,我收到错误,说没有这样的方法。如何在不使用GKScore已弃用的reportScoreWithCompletionHandlerMethod的情况下解决此问题?

1 个答案:

答案 0 :(得分:5)

所以苹果的事情有一个错字。 GKLeaderboard应该是reportScores系列中的GKScore。

相关问题