Search code examples
iosobjective-cgame-centergamekit

How do you load the default leaderboard prior to 6.0?


When loading the default leaderboard, it seems you have to detect whether the user is running iOS 6.0 or 7.0.

For 7.0, you use loadDefaultLeaderboardIdentifierWithCompletionHandler.

For 6.0, you use loadDefaultLeaderboardCategoryIDWithCompletionHandler.

But what if the user is running 5.0 or even 4.0?


Solution

  • Back in the iOS 5 days, you didn't retrieve the default category ID. You simply initialized a score with -[GKScore init] and the score was submitted to the default category. To retrieve the scores in the default category, you supplied the category ID via -[GKLeaderboard setCategory:].

    I'd link to the iOS 5 docs, but I can't find the individual pages online. If you like, you can download the docset here. (Unarchive it with xar.)