无法在Game Center iOS 7中获取排行榜得分

时间:2014-01-11 18:39:16

标签: ios ios7 sandbox game-center leaderboard

我正在尝试使用apple docs中提供的代码从Game Center(沙盒模式)获取默认排行榜分数。它适用于除iOS 7以外的所有iOS版本。我已根据iOS 7的要求添加了标识符属性,但它返回此错误:

Error Domain=GKErrorDomain Code=17 "The requested operations could not be completed because one or more parameters are invalid." UserInfo=0x16c5cdf0 {GKServerStatusCode=5053, NSUnderlyingError=0x16cb68a0 "The operation couldn’t be completed. status = 5053, asking for legacy aggregate leaderboard on a game with no legacy aggregate leaderboard", NSLocalizedDescription=The requested operations could not be completed because one or more parameters are invalid.

我用来检索分数的代码:

GKLeaderboard *leaderboardRequest = [[GKLeaderboard alloc] init];

if (leaderboardRequest != nil)
{
    leaderboardRequest.playerScope = GKLeaderboardPlayerScopeGlobal;
    leaderboardRequest.timeScope = GKLeaderboardTimeScopeAllTime;
    leaderboardRequest.identifier = @"LEADERBOARD_NAME";
    leaderboardRequest.range = NSMakeRange(1,100);
    [leaderboardRequest loadScoresWithCompletionHandler: ^(NSArray *scores, NSError *error) {
        if (error != nil)
        {
            // Handle the error.
            NSLog(@"%@",error.description);
        }
        if (scores != nil)
        {
            // Process the score information.
        }
    }];
}

提前致谢!

0 个答案:

没有答案