Domanda

I´m using XCode 5.0 and i got this exception at runtime:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView setImageWithURL:placeholderImage:options:]

I have download the SDWebImage from GitHub and:

  • Imported the project SDWebImage to my project
  • Imported < SDWebImage/UIImageView+WebCache.h> to the header file
  • Imported ImageIO.framework
  • At Build Settings in Other Linker Flags i´ve put the -ObjC flag
  • At Build Phases in Target Dependencies i´ve hadded SDWebimage
  • At Build Phases in Link Binary With Libraries i´ve hadded libSDWebImage.a

The project is running without error but i get the exception above at this method:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath

in this line:

[cell.imageMeme setImageWithURL:[NSURL URLWithString:meme.linkImage]
                   placeholderImage:[UIImage imageNamed:@"placeholder"] options:indexPath.row == 0 ? SDWebImageRefreshCached : 0];
È stato utile?

Soluzione

I deleted the SDWebImage i had imported and imported only the folder SDWebImage with the .m and .h files. This way the project runs and it doesn't throw an exception.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top