【问题标题】:iOS SDWebImage unrecognized selector complete-blockiOS SDWebImage 无法识别的选择器完成块
【发布时间】:2012-12-15 10:49:51
【问题描述】:

我在我的 iPhone 项目中使用SDWebImage 来自动加载和缓存图像。基本用法完美:

[self.imageView setImageWithURL:[NSURL URLWithString:*url*]];

但是当我使用带有额外参数选项的任何其他方法时,例如我想使用的带有完成块的方法:

[self.posterImageView setImageWithURL:[NSURL URLWithString:[Utils getMoviePosterUrlForMovie:movie withSize:PosterSizeBig]]
                          completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) { }];

我得到错误:

'NSInvalidArgumentException', reason: '-[UIImageView setImageWithURL:completed:]: unrecognized selector sent to instance

我发现的与无法识别的选择器错误有关的所有其他问题和解决方案都是整个库的问题,其中基本的“setImageWithURL”方法也不起作用。

这可能是什么问题?谢谢!

【问题讨论】:

  • 您是否在文件中包含 UIImageView+WebCache.m 以针对您的目标进行编译?

标签: ios automatic-ref-counting objective-c-blocks unrecognized-selector sdwebimage


【解决方案1】:

这也是我面临的问题,我通过在 Build Settings>TARGETS>Linking>Other Linker Flags 中设置标志来解决

-force_load ${BUILT_PRODUCTS_DIR}/libSDWebImage.a

如本链接所示:

SDWebImage : setImageWithURL fails when used to set image of a UITableViewCell

有点晚了,希望对你有所帮助

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-07-13
    • 1970-01-01
    • 2012-03-08
    • 1970-01-01
    • 1970-01-01
    • 2012-09-14
    • 1970-01-01
    相关资源
    最近更新 更多