[英]iOS 7 - game center leaderboard integration
- (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 https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/GameKit_Guide/LeaderBoards/LeaderBoards.html
On the above site, I used the above code (and the title was Reporting a score to Game Center (iOS 7)) but on the GKLeaderboard reportScores... line, I get an error saying that there is no such method. 在上面的网站上,我使用了上面的代码(标题是向Game Center报告分数(iOS 7)),但是在GKLeaderboard reportScores ...行上,我收到一条错误消息,指出没有这种方法。 How do i fix this without using GKScore's deprecated reportScoreWithCompletionHandlerMethod?
如何在不使用GKScore不推荐使用的reportScoreWithCompletionHandlerMethod的情况下解决此问题?
So apple's thing had a typo. 苹果的东西有错字。 GKLeaderboard was supposed to be GKScore in the reportScores line.
GKLeaderboard应该是reportScores行中的GKScore。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.