0

I am facing the issue ,below is the code. It shows error for the very first time and then no completion block is calling .

[self.comicsImage setImageWithURL:[NSURL URLWithString:self.imageUrl]
                         completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType)

Please help. If the image is not on the server it shows error first time then it does nothing on again requesting the same URL.Thanks in advance.

Nishant Tyagi
  • 9,893
  • 3
  • 40
  • 61
Sishu
  • 1,510
  • 1
  • 21
  • 48

1 Answers1

2

Because it caches the retured image for the requested url, 2nd time it returns what is in the cache for the given url.

Try this code, it should work for you

 [self.comicsImage setImageWithURL:[NSURL URLWithString:self.imageUrl]
                         completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType){
                              if (cacheType == SDImageCacheTypeNone)
                              {
                                   //your code here
                               }
}];
Thilina Chamath Hewagama
  • 9,039
  • 3
  • 32
  • 45