I’m tracking down a bug report with a game that has a bunch of achievements that do work.
I am trying to reveal the name of a hidden achievement once a player learns it is possible, but before they have any progress towards it.
GKAchievement* a = [[GKAchievement alloc] initWithIdentifier: anAchievement];
a.percentComplete = 0;
[GKAchievement reportAchievements: @[ a ] withCompletionHandler: ^(NSError * _Nullable error) {
if (error != nil) {
NSLog(@"revealAchievement: %@ failed %@", anAchievement, error);
}
}];
The documentation says “isHidden is set to NO anytime this method is invoked” but the achievement is not showing up in the UI. The achievement in question is returned by +loadAchievementsWithCompletionHandler:, but it is considered hidden there
(lldb) po a
<GKAchievement: 0x6000027993e0>id: MonsterKiller.DarkAge 0.000000
(lldb) p a.hidden
(BOOL) $3 = YES
I am pretty sure this code worked fine (it’s in a game that came out several years ago). Has Game Center changed (I know hidden is technically deprecated now, but I don’t see anything explaining how to reveal an achievement other than by using +reportAchievements:withCompletionHandler:.
And yes, the achievement in question is configured on the server (it can be earned, just not revealed with zero progress).