【问题标题】:SDWebimage exception at runtimeSDWebimage 运行时异常
【发布时间】:2014-01-14 03:33:01
【问题描述】:

我正在使用 XCode 5.0,我在运行时遇到了这个异常:

由于未捕获的异常而终止应用程序 'NSInvalidArgumentException',原因:'-[UIImageView setImageWithURL:placeholderImage:options:]

我已经从 GitHub 下载了 SDWebImage 并且:

  • 将项目 SDWebImage 导入到我的项目中
  • 导入到头文件
  • 导入ImageIO.framework
  • 在 Other Linker Flags 的 Build Settings 中,我放置了 -ObjC 标志
  • 在 Target Dependencies 的 Build Phases 中,我已经完成了 SDWebimage
  • 在 Link Binary With Libraries 的 Build Phases 中,我已经了解了 libSDWebImage.a

项目运行没有错误,但我在这个方法上得到了上面的异常:

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

在这一行:

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

【问题讨论】:

  • 什么是meme.linkImage?是NSString 还是NSURL?
  • 尝试不带选项 - [cell.imageMeme setImageWithURL:[NSURL URLWithString:meme.linkImage] placeholderImage:[UIImage imageNamed:@"placeholder"]];
  • @Bhumeshwerkatre meme.linkImage 是我想要的图片的链接。
  • 是NSString类型还是NSURL类型?
  • @Bhumeshwerkatre 它是 NSString

标签: ios cocoa caching sdwebimage


【解决方案1】:

我删除了已导入的 SDWebImage,只导入了包含 .m 和 .h 文件的文件夹 SDWebImage。这样项目就运行了,不会抛出异常。

【讨论】:

  • 如果您的问题已经解决,请接受您的回答。将来会帮助其他人。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-08-03
  • 2014-02-26
  • 2013-04-06
  • 2017-02-04
  • 2012-03-02
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多