奇怪的游戏中心行为?
我正在尝试为我的 iPad 游戏启用 Game Center 排行榜,并且我了解到您需要将多个分数发布到排行榜,以便分数显示在默认排行榜 UI 中。
我有两个独立的帐户,我曾经将两个不同的分数发布到同一个排行榜,但是当我调用 loadScoresWithCompletionHandler 时,我只得到一个分数(我当前登录的用户的分数)。
有什么想法吗?
GKLeaderboard *myLB = [[GKLeaderboard alloc] init];
myLB.category = @"MyLeaderboardId";
myLB.timeScope = GKLeaderboardTimeScopeAllTime;
myLB.playerScope = GKLeaderboardPlayerScopeGlobal;
myLB.range = NSMakeRange(1, 100);
[myLB loadScoresWithCompletionHandler:^(NSArray *scores, NSError *error) {
if (error != nil)
{
NSLog(@"%@", [error localizedDescription]);
}
if (scores != nil)
{
for (GKScore *score in scores)
{
NSLog(@"%lld", score.value);
}
}
}];
I'm trying to enable Game Center Leaderboard to my iPad game and I have learned that you need to post more than one score to a leaderboard for the scores to show in the default leaderboard UI.
I have two separete accounts that I used to post two different scores to the same leaderboard, but when I call loadScoresWithCompletionHandler I only get one score back (the score for the user I currently are logged in with).
Any ideas why?
GKLeaderboard *myLB = [[GKLeaderboard alloc] init];
myLB.category = @"MyLeaderboardId";
myLB.timeScope = GKLeaderboardTimeScopeAllTime;
myLB.playerScope = GKLeaderboardPlayerScopeGlobal;
myLB.range = NSMakeRange(1, 100);
[myLB loadScoresWithCompletionHandler:^(NSArray *scores, NSError *error) {
if (error != nil)
{
NSLog(@"%@", [error localizedDescription]);
}
if (scores != nil)
{
for (GKScore *score in scores)
{
NSLog(@"%lld", score.value);
}
}
}];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它对我来说效果很好。只需在另一个帐户下添加分数即可。
我得到了
:)
并且通过标准控制器居中显示相同的结果。
谢谢,
It works fine for me. Just add scores under another account.
I've got:
)
And center by standard controller show same results.
thanks,