I have a question related to Game center achievements. Is it possible to retrieve the name/description of an achievement by its identifier? I am trying to avoid hardcoding every identifier with its corresponding name, so is there a solution that can get the name? thanks, Sami
Game Center uses the Apple ID that's linked to your iPhone or iPad by default. Since Game Center accounts are tied to Apple accounts, you may have been under the notion that you cannot use a different account unless you completely sign out of your device.
Open your Settings Application then locate "Game Center" and tap on this. Your Game Center ID is your Apple ID. After iOS 10 there is no Game Center app, so all Game Center settings must be managed in here. For iOS 10 you can see your Game Center username in the Game Center application.
Make sure you have connected your game to Game Center. It is the only way to save, recover and sync your progress. Your account is not saved via connecting it to Facebook.
In the App Store on your Mac, click Arcade in the sidebar. Click your name in the bottom-left corner, then click Game Center Profile near the top of the window. To see your friends’ achievements, click Recently Played With. You can also see your Game Center profile, achievements, friends’ achievements, and more in the Game Center in-game dashboard.
This method is called when the player completes an achievement. The first thing the code does is create a new achievement object to tell Game Center that the achievement has been completed. If the player completes multiple achievements for a challenge at once, create a new object for each achievement and add the achievement to an array.
If you play a lot of games, it's great to be able to brag to your friends about your achievements. Of course, if you play a lot of games, you get a lot of achievements. To double check which ones you have earned, you can find them in Game Center on iOS 8. Here's how:
Your achievement ID is a permanent setting and therefore cannot be edited at a later date. The achievement ID is used inside your game to refer to this achievement. The points that your achievement is worth. Achievements marked as Hidden remain hidden to a player on Game Center until after the first time you report progress for that achievement.
Of course, that's exactly why you have localization support for achievements (as well as leaderboards) inside iTunes Connect.
However, there is no way to ask Game Center about localized info for just one achievement based on it's ID. Instead, you ask for info about all achievements which gives you an array of GKAchievementDescription objects which would be best to put into a dictionary where keys are achievement IDs and then you select a proper GKAchievementDescription object from that dictionary.
NSMutableDictionary *achievementDescriptions = [[NSMutableDictionary alloc] init];
[GKAchievementDescription loadAchievementDescriptionsWithCompletionHandler:^(NSArray *descriptions, NSError *error) {
if (error != nil) {
NSLog(@"Error getting achievement descriptions: %@", error);
}
for (GKAchievementDescription *achievementDescription in descriptions) {
[achievementDescriptions setObject:achievementDescription forKey:achievementDescription.identifier];
}
}];
And then when you want to display info for some achievement:
GKAchievementDescription *achievementDescription = [achievementDescriptions objectForKey:currentAchievement.identifier];
This object gives you a localized title, description for when it is achieved and unachieved, as well as number of points it awards and an image you specified in iTunes Connect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With