Null loadAchievementDescriptionsWithCompletionHandler,NSMutableDictionary始终为空
我已经尝试了几个小时,但我无法实现这一点,在我的GameCenterManager课程中,我得到了:Null loadAchievementDescriptionsWithCompletionHandler,NSMutableDictionary始终为空,null,game-center,nsmutabledictionary,gamekit,achievements,Null,Game Center,Nsmutabledictionary,Gamekit,Achievements,我已经尝试了几个小时,但我无法实现这一点,在我的GameCenterManager课程中,我得到了: - (void) retrieveAchievmentMetadata { self.achievementsDescDictionary = [[NSMutableDictionary alloc] init]; [GKAchievementDescription loadAchievementDescriptionsWithCompletionHandler: ^(NSArray *de
- (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]);
}
}
}];
}
这一切都是可行的,输出是好的,计数是好的,但是当我试图调用它从另一个类中获取GKAchievementDescription时,它总是返回null,计数是0
NSLog(@"count %i", [gameCenterManager.achievementsDescDictionary count]);
if (gameCenterManager.achievementsDescDictionary == NULL) {
NSLog(@"ERROR");
}
我快疯了,任何帮助都会很好。谢谢。可能是self.AchievementsDescription中的自我问题 在.h中使用
@property (retain) NSMutableDictionary* achievementsDescDictionary;
在电视上
@synthesize achievementsDescDictionary;
...
achievementsDescDictionary = [[NSMutableDictionary alloc] init];