Thanks for considering to open an issue. Before you submit your issue, please confirm these boxes are checked.
Loading problem on cached images.
If i load the image very quickly in tableview, i get notCurrentSourceTask error. Additional info, my table view, can be reloaded frequently. Why is this error caused ?
[Tell us about the issue]
imageSettingError(reason: Kingfisher.KingfisherError.ImageSettingErrorReason.notCurrentSourceTask(result: Optional(Kingfisher.RetrieveImageResult(image:
That means a new image downloading task is started before the previous one has a chance to finish. When the previous one finishes, it will trigger its completion handler with this error.
Kingfisher will handle the case correctly and set the image which is loaded lastly. So in most cases, you can just ignore this error.
Thanks, yes, you are right. I sloved it like this.
self.photo.kf.setImage(with: viewModel.photoURL, placeholder: viewModel.dummyImage, options: options, progressBlock: nil) { [weak self] result in
switch result {
case .success: break:
case .failure(let error):
if !error.isTaskCancelled && !error.isNotCurrentTask {
self?.photo.image = Images.failImage
}
}
}
Good to know it. But if this is what you want to do (setting a failure image), maybe this would be a more elegant solution: https://github.com/onevcat/Kingfisher/blob/master/Sources/General/KingfisherOptionsInfo.swift#L182-L185
Awesome, thank you for your response.
Most helpful comment
That means a new image downloading task is started before the previous one has a chance to finish. When the previous one finishes, it will trigger its completion handler with this error.
Kingfisher will handle the case correctly and set the image which is loaded lastly. So in most cases, you can just ignore this error.