编辑:我在SDWebImage : setImageWithURL fails when used to set image of a UITableViewCell
找到了解决方案我有UITableView,它正在使用SDWebImage,它工作得很好,但我决定从我的应用程序中删除ShareKit。我相信我所做的就是删除ShareKit,删除对它的任何引用,然后重新安装ObjectiveFlickr,JSONKit和LFWebAPIkit。我不在此表中使用所有这些。在我这样做之后,一切都有效,除了这个桌面视图。
我收到此错误:
-[UIImageView setImageWithURL:placeholderImage:]: unrecognized selector sent to instance 0x86b31a0
我没有问题编译和自动完成,我甚至删除并重新读取SDWebImage但它没有做任何事情。一切运行正常,但当它试图用UIImageView加载表时,它立即崩溃在这一行:
[cell.imageView setImageWithURL:[v thumbURL] placeholderImage:[UIImage imageNamed:@"46-movie-2.png"]];
这是我的代码:
- (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;
}
当我删除ShareKit时出现问题的任何想法?有任何想法如何排除故障?
答案 0 :(得分:2)
这将解决问题:打开“Build Settings”选项卡,在“Linking”部分找到“Other Linker Flags”设置并添加“-ObjC”标志:
答案 1 :(得分:0)
检查您是否已将SDWebImage标头导入您的班级。
答案 2 :(得分:0)
我在这里找到答案:SDWebImage : setImageWithURL fails when used to set image of a UITableViewCell
我在我的构建设置“Other Linker Flags”中添加了“-force_load $ {BUILT_PRODUCTS_DIR} /libSDWebImageARC.a”,现在可以使用了。
答案 3 :(得分:0)
通过Cocoapods使用SDWebImage
时出现此错误。事实证明,SDWebImage
pod列在Podfile中的错误目标下。将它移到文件的顶部对我有用。