Resetting Achievements

There are circumstances when you might want to reset user achievements. Besides being extremely helpful in debugging, you might find it useful to provide users with an option to reset. You might want to add a prestige mode or give the users a chance to start your game over from the beginning. The following code snippet will completely reset all achievements in your app for the local user.

- (void)resetAchievements {   [self setEarnedAchievementCache:NULL];   [GKAchievement resetAchievementsWithCompletionHandler:^(NSError *error) {      if (error == NULL) {        NSLog(@"Achievements have been reset");      } else {        NSLog(@"There was an error in resetting the achievements: %@", [error   localizedDescription]); ...

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.