iOS 游戏中心:沙盒中的分数未显示在排行榜上
我正在开发一款支持 Game Center 的游戏,但在沙盒环境中遇到了问题。我可以成功报分,没有错误。但是,当我显示排行榜时,看不到分数。为了验证分数是否确实到达那里,我使用以下代码查询本地用户的分数:
-(void)retrieveLocalScoreForCategory:(NSString *)category
{
GKLeaderboard *leaderboardRequest = [[GKLeaderboard alloc] init];
leaderboardRequest.category = category;
[leaderboardRequest loadScoresWithCompletionHandler: ^(NSArray *scores,NSError *error)
{
[self callDelegateOnMainThread: @selector(localPlayerScore:error:) withArg: leaderboardRequest.localPlayerScore error: error];
}];
}
在我的委托中,我将分数记录到控制台,我可以看到那里的正确分数。我已经验证我正在使用正确的排行榜类别 ID 显示排行榜(我只有一个)。
有谁知道为什么我的分数不能立即显示在沙盒环境中的排行榜上?分数显示之前是否有延迟?
I'm developing a Game Center enabled game and I'm running into an issue in the sandbox environment. I can successfully report the score without error. However, when I show the leaderboard, there are no scores visible. To verify that the score actually got there, I query the local user's score with the following code:
-(void)retrieveLocalScoreForCategory:(NSString *)category
{
GKLeaderboard *leaderboardRequest = [[GKLeaderboard alloc] init];
leaderboardRequest.category = category;
[leaderboardRequest loadScoresWithCompletionHandler: ^(NSArray *scores,NSError *error)
{
[self callDelegateOnMainThread: @selector(localPlayerScore:error:) withArg: leaderboardRequest.localPlayerScore error: error];
}];
}
In my delegate I log the score to the console and I can see the correct score got there. I have already verified that I'm showing the leaderboard using the correct leaderboard category id (I only have one).
Does anyone know why my score isn't visible on the leaderboard in the sandbox environment immediately? Is there a delay before the score shows up?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在从事的项目中遇到了同样的问题。
仅当排行榜上有两名或更多玩家时,GC 排行榜(沙盒/实时)才会返回分数。
因此,请确保您在一台设备上使用 2 个不同帐户提交分数,或者在不同设备上使用 2 个不同帐户提交分数。
I ran into the same issue with projects I've worked on.
The GC Leaderboards (Sandbox/live) will only return scores if there are two or more players on the Leaderboards.
So make sure you either submit the score with 2 different accounts on one 1 device or 2 different accounts on separate devices.
尝试更改时间范围。
有时 GKLeaderboardTimeScopeAllTime 和GKLeaderboardTimeScopeToday 不返回任何内容,但 GKLeaderboardTimeScopeWeek 工作正常。我认为这是GC沙箱服务器的问题。
听听苹果公司的说法:利用这数十亿美元中的一部分来改善您的网络服务。
Try changing timeScope.
Sometimes GKLeaderboardTimeScopeAllTime & GKLeaderboardTimeScopeToday returns nothing but GKLeaderboardTimeScopeWeek works fine. I think it's a GC sandbox server problem.
Hear us Apple: use some of those billions to make your web services better.