Search code examples
iosleaderboard

Retrieve all scores in a GKLeaderboard


How can I retrieve all scores for a GKLeaderboard? (I'm making my own leaderboard graphics). I'd need to know the number of scores in a certain leaderboard, but there seems to be no way of polling GC for that kind of information?

http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/GameKit_Guide/LeaderBoards/LeaderBoards.html#//apple_ref/doc/uid/TP40008304-CH6-SW14


Solution

  • I'm getting the feeling the answer is the maxRange property of GKLeaderboard. The docs:

    This property is invalid until a call to loadScoresWithCompletionHandler: is completed. Afterward, it contains the total number of entries available to return to your game given the filters you applied to the query.

    http://developer.apple.com/library/ios/documentation/GameKit/Reference/GKLeaderboard_Ref/Reference/Reference.html#//apple_ref/occ/instp/GKLeaderboard/maxRange

    So this would be the number of rows in a leaderboard table view.