iOS Game Center Sandbox: Leaderboards show “No score”

核能气质少年 提交于 2019-12-04 09:43:31

It suddenly started working (without any code change or even a recompile). I figure it takes a while for the leaderboards to actually appear, for me about 18 hours.

Scores submitted within this time will still record, they just wont be visible instantly.

I never got scores to add to the sandbox either, but here is the code I implemented, and it works fine with the version currently in the app store:

GKScore * score = [[[GKScore alloc] initWithCategory:@"com.example.appname.scoreboardname"] autorelease];
score.value = [[NSUserDefaults standardUserDefaults] integerForKey:@"NEWSCORE"];
[score reportScoreWithCompletionHandler:^(NSError *error) {
    dispatch_async(dispatch_get_main_queue(), ^(void) {
        if (error == NULL) {
            NSLog(@"Score Sent");
        } else {
            NSLog(@"Score Failed");
        }
    });
}];

just make sure your GKScore.value is of type int64_t

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!