No visible @interface for 'UIImageView' declares selector 'setImageWithURL'
Good day,
I am trying to use SDWebImage in my TableViewController and I am getting 2 errors (one for each image item), but I can run the application and I can see that SDWebImage is working fine, but with these 2 errors.
How is this possible? I'm really glad SDWebImage worked, but I don't know if it shows these errors and then it works.
Also I want to say that when I use " setImageWithURL " it works with these 2 errors (but this function is unrelated), but when I use " sd_setImageWithURL doesn't work and I also have these 2 errors (but sd_setImageWithURL is related to files SDWebImage).
So which one should I use? Because I want this to make it work, but I want it to work fine without errors.
I am getting the following error:
No visible @interface for 'UIImageView' declares selector 'setImageWithURL: placeholderImage: options:'
Find below code:
CarTableViewController.m
#import "CarTableViewController.h"
#import "CarTableViewCell.h"
#import "CarTableViewController.h"
#import "CarDetailViewController.h"
#import <SDWebImage/UIImageView+WebCache.h>
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"carTableCell";
CarTableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[CarTableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
}
// Configure the cell...
cell.makeLabel.text = [[_jsonArray objectAtIndex:indexPath.row] valueForKey:@"id"];
cell.likes.text = [[_jsonArray objectAtIndex:indexPath.row] valueForKey:@"likes"];
cell.comments.text = [[_jsonArray objectAtIndex:indexPath.row] valueForKey:@"comments"];
cell.username.text = [[_jsonArray objectAtIndex:indexPath.row] valueForKey:@"username"];
cell.refuser.text = [[_jsonArray objectAtIndex:indexPath.row] valueForKey:@"user_ref"];
cell.modelLabel.text = [[_jsonArray objectAtIndex:indexPath.row] valueForKey:@"user"];
NSURL * imageURL = [NSURL URLWithString:[[_jsonArray objectAtIndex:indexPath.row] valueForKey:@"imagen"]];
[cell.carImage setImageWithURL:imageURL
placeholderImage:[UIImage imageNamed:@"placeholder.png"]
options:SDWebImageRefreshCached];
NSURL * imageURL2 = [NSURL URLWithString:[[_jsonArray objectAtIndex:indexPath.row] valueForKey:@"image"]];
[cell.profileImage setImageWithURL:imageURL2
placeholderImage:[UIImage imageNamed:@"image"]
options:SDWebImageRefreshCached];
return cell;
}
And that's my CarTableViewCell.h :
#import <UIKit/UIKit.h>
@interface CarTableViewCell : UITableViewCell
@property (nonatomic, strong) IBOutlet UIImageView *carImage;
@property (nonatomic, strong) IBOutlet UILabel *makeLabel;
@property (nonatomic, strong) IBOutlet UILabel *modelLabel;
@property (nonatomic, strong) IBOutlet UILabel *likes;
@property (nonatomic, strong) IBOutlet UILabel *comments;
@property (nonatomic, strong) IBOutlet UILabel *username;
@property (nonatomic, strong) IBOutlet UILabel *refuser;
@property (nonatomic, strong) IBOutlet UIImageView *profileImage;
@end
Thanks in advance.
source to share