Earned or Unearned Achievements

The easiest achievement from Table 4.1 to implement is the com.dragonforged.whackacac.killone achievement. Whenever you’re working with adding a hook for an achievement, the first step is to retrieve a copy of the GKAchievement that will be incremented. Use the method discussed in the section “Adding Achievement Hooks” to grab an up-to-date copy of the achievement.

GKAchievement *killOneAchievement = [[ICFGameCenterManager sharedManager] achievementForIdentifier: @"com.dragonforged.whackacac.killone"];

Next a query is performed to see whether this achievement has already been completed. If it has, there is no need to update it again.

if(![killOneAchievement ...

Get iOS Components and Frameworks: Understanding the Advanced Features of the iOS SDK 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.