5

当图像 url 未更改但图像更改(例如 Twitter 或 GitHub)时,如何使用 Kingfisher 检索正确的图像。

SDWebImage有一个选项 [SDWebImageRefreshCached] 来解决这个问题。

   /**
     * Even if the image is cached, respect the HTTP response cache control, and refresh the image from remote location if needed.
     * The disk caching will be handled by NSURLCache instead of SDWebImage leading to slight performance degradation.
     * This option helps deal with images changing behind the same request URL, e.g. Facebook graph api profile pics.
     * If a cached image is refreshed, the completion block is called once with the cached image and again with the final image.
     *
     * Use this flag only if you can't make your URLs static with embedded cache busting parameter.
     */
    SDWebImageRefreshCached = 1 << 4,

如何解决Kingfisher中的问题?

4

1 回答 1

2

Kingfisher有 forceRefresh 选项来强制再次下载图像跳过缓存

imageView.kf.setImage(with: url, options: [.forceRefresh])

有关更多详细信息,请参阅此github线程

于 2017-10-12T06:45:54.243 回答