当我更新 Kingfisher 时本地 gif 没有显示

Local gif didn't show when I updated Kingfisher

我将 Kingfisher 从 4.10 更新到 5.7,但是,使用相同的代码,gif 没有显示在 imageView 上。

这是我的代码:

let path = Bundle.main.path(forResource: "loading", ofType: "gif")!
let resource = ImageResource(downloadURL: URL(fileURLWithPath: path))
imageView.kf.setImage(with: resource)

它与 Kingfiser 4.10 配合得很好。

Kingfisher 库有 local image provider 必须用于加载本地图像。

所以你的代码应该改成这样:

let path = Bundle.main.url(forResource: "loading", withExtension: "gif")!
let resource = LocalFileImageDataProvider(fileURL: path)
imageView.kf.setImage(with: resource)