erkanyildiz
erkanyildiz

Reputation: 13204

GKLeaderboardViewController initial leaderboard

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?

Upvotes: 2

Views: 2288

Answers (3)

Jose Maria Toro
Jose Maria Toro

Reputation: 1

The category property is deprecated in iOS 6 and above.

Try this:

leaderboardController.identifier = @"Your leaderboard identifier as defined on iTunes connect";

Upvotes: 0

Jonny
Jonny

Reputation: 16298

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

Upvotes: 0

andrew.creamentas
andrew.creamentas

Reputation: 86

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];

Upvotes: 5

Related Questions