2013-11-04 63 views
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的iOS 7 - 遊戲中心排行榜集成

在上述網站,我用上面的代碼(和標題被上報比分遊戲中心(的iOS 7)),但在GKLeaderboard reportScores。 ..線,我得到一個錯誤,說沒有這樣的方法。我如何解決這個問題,而不使用GKScore棄用的reportScoreWithCompletionHandlerMethod?

回答

5

所以蘋果的東西有一個錯字。 GKLeaderboard應該是reportScores系列中的GKScore。