我在应用商店有一个小游戏,使用游戏套件的排行榜。仅来自 Xcode 文档的代码。
- (void) reportScore: (int64_t) score forCategory: (NSString*) category {
if (!auth_ok)
return;
Class gcClass = (NSClassFromString(@"GKScore"));
GKScore *scoreReporter = [[[gcClass alloc] initWithCategory:category] autorelease];
scoreReporter.value = score;
[scoreReporter reportScoreWithCompletionHandler:^(NSError *error) {
if (error != nil) {
NSLog(@"%@",error);
}
else {
NSLog(@"reportScore ok!");
}
}];
}
它永远不会出错。但是今天我使用 Xcode 3.2.5 构建了这个项目。并更改一些其他代码,我现在发现 GKScore 报告分数是错误的。我这样称呼reportScore消息:
int winCount=15;
[gameView reportScore:winCount forCategory:@"memory.iphone.wincount"];
结果是 value=761228871165046176.like 那个: