UIImage *image = [[SDImageCache sharedImageCache] imageFromDiskCacheForKey:_actualImageURL.absoluteString];
if(!image) {
image = [UIImage imageNamed:@"placeholderImage"];
[self makeImageAvailableAtURL:_actualImageURL];
}
self.messageImage.image = [image isImageGif] ? image.images.lastObject : image;
We are loading image from server. If it is some gif image, we get image with .images
( i got no another way how to understand is it gif or not).
- (BOOL)isImageGif {
return self.images;
}
But if we store gif image with
[[SDImageCache sharedImageCache] storeImage:image forKey:wImageURL.absoluteString];
,it lose .images
.
Any idea how handle this?
Well, solution is using:
[[SDImageCache sharedImageCache] storeImage:image recalculateFromImage:NO imageData:data forKey:key toDisk:YES];
instead just:
[[SDImageCache sharedImageCache] storeImage:image forKey:key];
I have found it there: https://github.com/rs/SDWebImage/issues/916