Chr*_*ris 4 iphone objective-c game-center
所以我将分数发送到GC排行榜,我没有收到任何错误,并且分数显着发送但我仍然看不到排行榜中列出的分数!排行榜本身列在游戏中心,没有得分.
根据Google搜索和此处的问题,可以通过尝试使用多个帐户记录分数来解决此问题.我现在已经在Simulator(iOS5)和iPhone上尝试了三个不同的帐户; 提交分数时,没有一个显示任何错误.
发送分数的代码在这里:
- (void)reportScore:(NSString *)identifier score:(int)rawScore {
GKScore *score = [[[GKScore alloc] initWithCategory:identifier] autorelease];
score.value = rawScore;
[scoresToReport addObject:score];
[self save]; // Save here even though we save again in didEnterBackground, just in case of crash...
if (!gameCenterAvailable || !userAuthenticated) return;
[self sendScore:score];
}
- (void)sendScore:(GKScore *)score {
[score reportScoreWithCompletionHandler:^(NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^(void)
{
if (error == NULL) {
NSLog(@"Successfully sent score!");
[scoresToReport removeObject:score];
} else {
NSLog(@"Score failed to send... will try again later. Reason: %@", error.localizedDescription);
}
});
}];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3628 次 |
| 最近记录: |