When GKLeaderboardViewController
is presented, it shows first leaderboard on the list, even if the GKLeaderboardViewController
's leaderboard category is not set. Only way to see the list of all leaderboards is clicking Leaderboards button at the top.
Is there any way to display list of all leaderboards when GKLeaderboardViewController
is presented?
You can set category to nil.
GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
if (leaderboardController != NULL)
{
//leaderboardController.category = kLeaderboardID;
leaderboardController.category = nil;
leaderboardController.timeScope = GKLeaderboardTimeScopeWeek;
leaderboardController.leaderboardDelegate = self;
[self presentModalViewController: leaderboardController animated: YES];
}
[leaderboardController release];
Apple docs:
The category property must either be nil or it must match a category
identifier you defined when you created your leaderboards on iTunes
Connect. If nil, the view displays scores for the aggregate
leaderboard. Default is nil.
http://developer.apple.com/library/ios/documentation/GameKit/Reference/GKLeaderboardViewController_Ref/Reference/Reference.html#//apple_ref/occ/instp/GKLeaderboardViewController/category
The category property is deprecated in iOS 6 and above.
Try this:
leaderboardController.identifier = @"Your leaderboard identifier as defined on iTunes connect";