1

Edit: I found the solution here SDWebImage : setImageWithURL fails when used to set image of a UITableViewCell

I have UITableView that's utilizing SDWebImage and it worked great but I decided to remove ShareKit from my app. All I believe I did was delete ShareKit, remove any references to it and then reinstall ObjectiveFlickr, JSONKit and LFWebAPIkit. All of which I don't use in this table. After I did that, everything works, except for this tableview.

I get this error:

-[UIImageView setImageWithURL:placeholderImage:]: unrecognized selector sent to instance 0x86b31a0

I have no problem compiling and with autocomplete and I even deleted and readdded SDWebImage but it doesn't do anything. Everything runs fine but when it tries to load the table with the UIImageView it crashes immediately on this line:

[cell.imageView setImageWithURL:[v thumbURL] placeholderImage:[UIImage imageNamed:@"46-movie-2.png"]];

Here's my code:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"YTVVideoTableCell";

YTVVideoTableCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) {
    cell = [[YTVVideoTableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}

Video *v = [[[VideoStore sharedStore] allItems] objectAtIndex:[indexPath row]];;

[cell.imageView setImageWithURL:[v thumbURL] placeholderImage:[UIImage imageNamed:@"46-movie-2.png"]];

[cell setController:self];
[cell setTableView:[self tableView]];

[[cell titleLabel] setText:[v title]];
[[cell titleLabel] alignBottom];

return cell;

}

Any ideas of what went wrong when I removed ShareKit? Any ideas how to troubleshoot?

Community
  • 1
  • 1
Billy Shih
  • 624
  • 6
  • 17
  • possible duplicate of [SDWebImage : setImageWithURL fails when used to set image of a UITableViewCell](http://stackoverflow.com/questions/8504953/sdwebimage-setimagewithurl-fails-when-used-to-set-image-of-a-uitableviewcell) – jscs Aug 14 '12 at 05:25

4 Answers4

2

This will solve the problem: Open the "Build Settings" tab, in the "Linking" section, locate the "Other Linker Flags" setting and add the "-ObjC" flag: enter image description here

Hossam Ghareeb
  • 7,063
  • 3
  • 53
  • 64
0

Check whether you have imported the SDWebImage header into your class.

ashokbabuy
  • 1,000
  • 10
  • 17
0

I found the answer here: SDWebImage : setImageWithURL fails when used to set image of a UITableViewCell

I added "-force_load ${BUILT_PRODUCTS_DIR}/libSDWebImageARC.a" to my build settings "Other Linker Flags" and it now works.

Community
  • 1
  • 1
Billy Shih
  • 624
  • 6
  • 17
0

I got this error when using SDWebImage through Cocoapods. Turns out, the SDWebImage pod was listed under the incorrect target in the Podfile. Moving it to the top of the file worked for me.

rounak
  • 9,217
  • 3
  • 42
  • 59