Search code examples
gamekitachievements

Is it possible to load image from GKAchievementDescription?


I'm using this method to load all achievements description.

[GKAchievementDescription loadAchievementDescriptionsWithCompletionHandler:
 ^(NSArray *descriptions, NSError *error) {
     CCLOG(@"achivements loaded");
     if (error != nil) {
         NSLog(@"Error %@", error);

 } else {
     if (descriptions != nil){
         CCLOG(@"nb %i",descriptions.count);
         for (GKAchievementDescription* a in descriptions) {
             CCLOG(@"image %@ %@ %@", a.title, a.achievedDescription, a.image);
             [achievementsDescDictionary setObject: a forKey: a.identifier];
         }
     } else {
         CCLOG(@"descriptions empty");
     }
     }
 }];

I always get a.image = null.

Thanks.


Solution

  • Actually you can't load images from Game Center.

    Just add your achievements Images into your project and use this method with GKAchievementHandler

    - (void)notifyAchievementTitleAndImage:(NSString *)title andMessage:(NSString *)message withImage:(UIImage *)image