diff --git a/SDWebImage/UIImageView+WebCache.m b/SDWebImage/UIImageView+WebCache.m index b25a234f..aa8ce431 100644 --- a/SDWebImage/UIImageView+WebCache.m +++ b/SDWebImage/UIImageView+WebCache.m @@ -71,15 +71,14 @@ - (void)sd_setAnimationImagesWithURLs:(nonnull NSArray *)arrayOfURLs { [self sd_cancelCurrentAnimationImagesLoad]; - __weak __typeof(self)wself = self; - NSPointerArray *operationsArray = [self sd_animationOperationArray]; - + [arrayOfURLs enumerateObjectsUsingBlock:^(NSURL *logoImageURL, NSUInteger idx, BOOL * _Nonnull stop) { + __weak __typeof(self) wself = self; id operation = [[SDWebImageManager sharedManager] loadImageWithURL:logoImageURL options:0 progress:nil completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { - if (!wself) return; + __strong typeof(wself) sself = wself; + if (!sself) return; dispatch_main_async_safe(^{ - __strong UIImageView *sself = wself; [sself stopAnimating]; if (sself && image) { NSMutableArray *currentImages = [[sself animationImages] mutableCopy];