I'm trying to fetch the default leaderboard scores from Game Center (Sandbox mode) using the code provided in apple docs. It works fine on all iOS versions except iOS 7. I've added the identifier property as required for iOS 7 but it returns this error:
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.
The code I'm using to retrieve scores:
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.
}
}];
}
Thanks in advance!