0
- (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

在上面的网站上,我使用了上面的代码(标题是 Reporting a score to Game Center (iOS 7)),但在 GKLeaderboard reportScores... 行上,我收到一条错误消息,指出没有这种方法。如何在不使用 GKScore 已弃用的 reportScoreWithCompletionHandlerMethod 的情况下解决此问题?

4

1 回答 1

5

所以苹果的东西有一个错字。GKLeaderboard 应该是 reportScores 行中的 GKScore。

于 2013-11-04T07:43:36.013 回答