Achieving playing a game center several times

I set the achievement for completing the first level of my game, and it works, but when I play the level and pass it, it again displays a notification banner, how can I prevent this?

+6
source share
2 answers

Use this method to represent achievement:

-(void) reportAchievementWithID:(NSString*) achievementID { [GKAchievement loadAchievementsWithCompletionHandler:^(NSArray *achievements, NSError *error) { if(error) NSLog(@"error reporting ach"); for (GKAchievement *ach in achievements) { if([ach.identifier isEqualToString:achievementID]) { //already submitted return ; } } GKAchievement *achievementToSend = [[GKAchievement alloc] initWithIdentifier:achievementID]; achievementToSend.percentComplete = 100; achievementToSend.showsCompletionBanner = YES; [achievementToSend reportAchievementWithCompletionHandler:NULL]; }]; } 
+11
source

Keep the user going through the level to NSUserDefaults , and then when the user passes the NSUserDefaults level NSUserDefaults for your key, if there is one, then do not do the achievement code for Game Center.

-2
source

Source: https://habr.com/ru/post/921887/


All Articles