I need images from URLs in my app and I also need to cache them for reuse.
Here is my code to download various images from various URLs:
__block UIActivityIndicatorView *activityIndicator = [UIActivityIndicatorView.alloc initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
[imgView addSubview:activityIndicator];
activityIndicator.center = CGPointMake(65, 65);
[activityIndicator startAnimating];
[imgView setImageWithURL:imageURL placeholderImage:nil completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType)
{
if (error)
NSLog(@"%@", [error description]);
[activityIndicator removeFromSuperview];
activityIndicator = nil;
}];
At a time I fire 4 requests. Out of them, only 3 gets the actual image. Remaining 1 image does not download and activityIndicator keeps animating forever.
Is there something I am missing in above code? I have copied this from their own example that comes with the SDK.