I've been trying for hours and I cannot get this to work, in my GameCenterManager class I've got this:
- (void) retrieveAchievmentMetadata {
self.achievementsDescDictionary = [[NSMutableDictionary alloc] init];
[GKAchievementDescription loadAchievementDescriptionsWithCompletionHandler:
^(NSArray *descriptions, NSError *error) {
if (error != nil) {
NSLog(@"Error %@", error);
} else {
if (descriptions != nil){
for (GKAchievementDescription* a in descriptions) {
[achievementsDescDictionary setObject: a forKey: a.identifier];
NSLog(@"identifier %@", a.identifier);
}
NSLog(@"count %i", [achievementsDescDictionary count]);
}
}
}];
}
It all works, the output is good, the count is good but when I try to call it to get a GKAchievementDescription from another class it always returns (null) and the count is 0.
NSLog(@"count %i", [gameCenterManager.achievementsDescDictionary count]);
if (gameCenterManager.achievementsDescDictionary == NULL) {
NSLog(@"ERROR");
}
I'm going crazy with this, any help will be great. Thanks.