Nathaniel
Nathaniel

Reputation: 41

uiImageView error with SDWebImage

After adding SDWebImage lib and putting their standard code:

[cell.imageView setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"] placeholderImage:[UIImage imageNamed:@"placeholder.png"]];

I get the next error:

ViewController.m: error: Automatic Reference Counting Issue: Receiver type 'UIImageView' for instance message does not declare a method with selector 'setImageWithURL:placeholderImage:'

How can I solve it?

Upvotes: 0

Views: 509

Answers (1)

sch
sch

Reputation: 27506

As the documentations says, you should import "UIImageView+WebCache.h", which is the header where the method setImageWithURL:placeholderImage: is declared in a UIImageView category.

#import "UIImageView+WebCache.h"

// ...

[cell.imageView setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"] placeholderImage:[UIImage imageNamed:@"placeholder.png"]];

Upvotes: 2

Related Questions