Local Player Score

There are often times that you will want to know the local players score on a given leaderboard. Maybe you want to display their score at the top of your leaderboard, or perhaps you want to fetch a leaderboard that shows other player scores that are close to your local player's score.

Apple has provided an easy technique for determining the local players score. During any GKLeaderboard request, it contains a property for localPlayerScore. We create a new method in our GameCenterManager to handle retrieving the local player score for us. Add the following method to your GameCenterManager class.

-(void)retrieveLocalScoreForCategory:(NSString *)category {         GKLeaderboard *leaderboardRequest = [[GKLeaderboard alloc] init]; ...

Get Beginning iOS Game Center and Game Kit: For iPhone, iPad, and iPod touch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.