ios - 奇怪的游戏中心行为?

标签 ios ios5 game-center leaderboard

我正在尝试为我的 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);
        }
    }
}];

最佳答案

它对我来说很好用。只需在另一个帐户下添加分数即可。

我有:

scores (
"<GKScore: 0x960e3e0><0x960e3e0> player=G:1208389607 rank=1 date=2012-01-19 12:56:47 +0000 value=27 formattedValue=27 context=(null)",
"<GKScore: 0x96a1bc0><0x96a1bc0> player=G:1176161436 rank=2 date=2012-01-19 08:35:06 +0000 value=16 formattedValue=16 context=(null)"

)

标准 Controller 的中心显示相同的结果。

谢谢,

关于ios - 奇怪的游戏中心行为?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8908752/

相关文章:

ios - 我已经成功地将 Storyboard UIWebView 连接到 iPhone 的 Controller ,但不能为 iPad 连接

ios - 在 GLKit/OpenGL-ES 中自动计算法线

iphone - Game Center localPlayer 始终经过身份验证

ios - Swift 显示 Game Center 排行榜

ios - React Native TabBarIOS.Item 中心图标

ios - 设置ZBar iOS SDK界面方向?

ios - 标签上不能换行

ios - Gamecenter 匹配数据未更新

java - 如何生成 CIDOC CRM 格式的 RDF 文件

Storyboard中 View Controller 委托(delegate)的 iOS Swift Xcode 6 关注点分离