问题描述
我正在尝试将游戏中心排行榜添加到我的iPad游戏中,并且我已经了解到您需要将多个分数发布到排行榜,以便在默认排行榜UI中显示分数。
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.
我有两个separete帐户,我曾经将两个不同的分数发布到同一个排行榜,但是当我调用loadScoresWithCompletionHandler时,我只得到一个分数(我当前登录的用户的分数) 。
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).
任何想法为何?
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);
}
}
}];
推荐答案
它对我来说很好。只需在其他帐户下添加分数。
It works fine for me. Just add scores under another account.
我有:
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)"
)
并居中标准控制器显示相同的结果。
And center by standard controller show same results.
谢谢,
这篇关于奇怪的游戏中心行为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!