【问题标题】:Images wont get cached when using SDWebImage使用 SDWebImage 时图像不会被缓存
【发布时间】:2013-02-04 01:30:41
【问题描述】:

我无法让 SDWebImage 正常工作。

我的 UITableView 总是显示图像,但缓存总是空的。

换句话说,图像没有连接到 SDWebImage 缓存。

另外,我在调用时收到错误无法识别的选择器发送到实例

setImageWithURL:placeholderImage:options:

但是当我使用时错误消失了

setImageWithURL:placeholderImage:

有什么想法吗?

【问题讨论】:

    标签: ios uitableview caching sdwebimage unrecognized-selector


    【解决方案1】:

    这是我的做法,它会正确缓存图像

    [cell.img setImageWithURL:imgURL placeholderImage:[UIImage imageNamed:@"somePlaceholder.png"]];
    

    介意告诉你为什么要使用setImageWithURL:placeholderImage:options: 吗?

    【讨论】:

    • 这对我有用,没有缓存。我真的不需要使用 setImageWithURL:placeholderImage:options: ,但这表明存在问题
    【解决方案2】:

    这件事今天发生在我身上,我实际上是在使用 AFNetworking 的 setImageWithURL:placeholderImage: 而不是 SDWebImage。我敢打赌,这种情况发生的次数比人们意识到的要多。

    如果您使用他们的静态库/框架,请确保您 #import <SDWebImage/UIImageView+WebCache.h>,或者如果您导入了 SDWebImage 的 .h 和 .m 文件,请确保您 #import UIImageView+WebCache。您可能需要完全删除 AFNetworking 的 UIImageView+AFNetworking 文件,具体取决于您拥有的版本。

    如果您这样做了,请仔细检查构建设置中的 Other linker flags 是否具有 -ObjC 规范。如果这让你见鬼去吧,请参阅this

    【讨论】:

      猜你喜欢
      • 2012-10-13
      • 1970-01-01
      • 1970-01-01
      • 2023-04-03
      • 1970-01-01
      • 2016-08-01
      • 1970-01-01
      • 2014-04-15
      • 1970-01-01
      相关资源
      最近更新 更多