Is it possible to load image from GKAchievementDescription?
-
01-07-2021 - |
Domanda
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.
Soluzione
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
Altri suggerimenti
if you can't load the images from game center then what about to create a plist file for mapping "achievements-images"? I used this technique for my game which is similar to 3-in-row to define various types of blocks
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow