Thursday Tech Tip – GK Leaderboard & Achievements

15 May , 2014 Technology,Thursday Tech Tips

Thursday Tech Tip – GK Leaderboard & Achievements

I needed to fix this week some errors I made in a game submission to the iOS App Store that leveraged Game Center Leaderboards and Achievements. I learned two valuable lessons I wanted to share here.

First, the correct syntax for submitting an achievement looks like this.

[self reportAchievement:@"10Percent4608" percentComplete:100.0];

The achievement string should match the exact ID that you have set up for it in Game Center. Also, unless a specific achievement can be earned incrementally (0-100%), make sure that the percentComplete value is actually set to the integer 100.0.

Second, the leaderboard ID is set once and only once for each instance where you report a score; like below.

GKLeaderboard *highscoreboard = [self leaderboardForIdentifier:@"4608"];

The identifier for the leaderboard is equal to the ID for the leaderboard that is set in Game Center.

Both of these value settings are pretty basic but you would be surprised how open-ended the developer docs read on these two points.

, , , ,

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.