Game Center achievements staying hidden

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).

Replies

Hi ddunham, thanks for the report.

I don’t see anything explaining how to reveal an achievement other than by using +reportAchievements:withCompletionHandler:.

They should work the same. Please use+reportAchievements:withCompletionHandler:, we'll get the documentation improved here!

Has Game Center changed 

I can't confirm this for sure, but it does indeed look like this was an optimization that has gone awry. We've got some logic to minimize additional network traffic by avoiding sending redundant achievement progress reports, and this is swallowing your submission. I can't promise a timeline on a fix, but we are tracking this now. Thanks again for reporting it.

One possible workaround would be to report 1% progress or similar. I'm sorry I don't have a better suggestion for you.

Cheers, Brandon

  • Hi ddunham, I enjoyed chatting with you at WWDC. While I can't comment on when it will be released, this issue has been fixed such that reporting 0% on hidden achievements causes them to become visible. While we'll likely preserve this behavior going forward there are plans to expose a proper "reveal" API in the future as well. Thanks again for the feedback here.

Add a Comment

Posting as a reply as well since my original post as a comment was an error :)

Hi ddunham, I enjoyed chatting with you at WWDC. While I can't comment on when it will be released, this issue has been fixed such that reporting 0% on hidden achievements causes them to become visible. While we'll likely preserve this behavior going forward there are plans to expose a proper "reveal" API in the future as well. Thanks again for the feedback here.