I am integrating Game Center onto my application, and I've done everything right, it's well but I have a problem. When an user completes an achievement, I wanted to add a notification. And I did manage to do that like this :
GKAchievement *achievement = [[GKAchievement alloc] initWithIdentifier:@"theFirstAchievement"];
achievement.percentComplete = sharedApp.firstAchievement = sharedApp.firstAchievement + 50;
[achievement reportAchievementWithCompletionHandler:^(NSError *error)
{
if (error != nil)
{
NSLog(@"achievement failed");
}
else
{
NSLog(@"achievement succeded");
}
}];
if (achievement.percentComplete == 100.0)
{
[GKNotificationBanner showBannerWithTitle:@"Achievement Unlocked:" message:@"Master Question Master!" completionHandler:nil];
}
My problem is, I don't know if I'm doing something wrong, but it is supposed to show a notification once, but, if I close my application and reopen, when I complete the achievement again it shows the notification again, even though it was already completed in my game center! What am I doing wrong? Thanks!