SDWebImageDownloader *downloader = [SDWebImageDownloader sharedDownloader];
[downloader downloadImageWithURL:[[NSURL alloc] initWithString:url]
options:0
progress:^(NSInteger receivedSize, NSInteger expectedSize) {
// progression tracking code
}
completed:^(UIImage *image, NSData *data, NSError *error, BOOL finished) {
if (image && finished) {
}});
Asked
Active
Viewed 43 times
-1

Patrick
- 1,629
- 5
- 23
- 44

Salah Mohamd
- 23
- 6
-
please explain in more detial, the title should be used to give a quick summary. then describe your issue, what you've tried and what your trying to acheive – Scriptable May 09 '16 at 10:18
2 Answers
0
If you want to use SDWebImage, then just download the data using the url and dont assign that to imageView and the library you are using will cache it by doing so.

Dharmendra Chaudhary
- 257
- 2
- 10
0
Try this one:
-(UIImage *)downloadImageAsync:(NSString *)imageKey
{
NSLog(@"image key : %@",imageKey);
__block UIImage *returnedImage;
SDWebImageManager *manager = [SDWebImageManager sharedManager];
[manager downloadWithURL:[NSURL URLWithString:imageKey] options:0 progress:^(NSUInteger receivedSize, long long expectedSize){
NSLog(@"received size %d expected size %lld", receivedSize, expectedSize);
}completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType,BOOL finished){
if(image && finished) {
returnedImage = image;
}
}];
if(returnedImage == nil) {
NSLog(@"Returned Image Nil");
}
return returnedImage;
}

Vijay Kachhadiya
- 366
- 2
- 11
-
For example when put array from photos url and do loop and use by [SDWebImageManager sharedManager]; to download the images it download only first image and other urls request did'nt enter to completion block – Salah Mohamd May 09 '16 at 13:47
-