-1
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) {
}});
Patrick
  • 1,629
  • 5
  • 23
  • 44
  • 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 Answers2

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.

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