-1

I'm using this function for downloading some images in looping for(int i=0;i<images.count;i++).

- (void)setImageWithURLRequest:(NSURLRequest *)urlRequest
              placeholderImage:(UIImage *)placeholderImage
                       success:(void (^)(NSURLRequest *request, NSHTTPURLResponse * __nullable response, UIImage *image))success
                       failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse * __nullable response, NSError *error))failure;

When images still downloading, I touch back from navigation, app get crash (Crash due to signal: SIGTRAP() at 193e73fb0).

What should I do? So even downloading is not completed yet, I tap back [self.navigationController popViewControllerAnimated:YES];, app will not crash.

Or maybe there are alternative way to do this?

Thanks before.

Hezron
  • 352
  • 1
  • 15
  • [link](http://stackoverflow.com/questions/15413955/how-to-cancel-exit-stop-execution-of-thread-object-or-thread-running-in-backgrou) here is a link try it, may be help you. – Pavankumar Feb 08 '17 at 04:12
  • @matt I think you don't need any information again. because the crash come when image still downloading. – Hezron Feb 08 '17 at 04:14

1 Answers1

0

for (int i=0;i<[img count];i++)

{

nsstring *obj=[img objectatindex:i];

[imgOffer sd_setImageWithURL:[NSURL URLWithString:obj]placeholderImage:[UIImage imageNamed:@""] options:0];

}

You can use SDWebimagecache and import this file #import "UIImageView+WebCache.h" to your viewcontroller

Prissy Eve
  • 156
  • 1
  • 15