Kingfisher
Kingfisher copied to clipboard
Image loading fails with notCurrentSourceTask even if the task is still valid
Check List
Thanks for considering to open an issue. Before you submit your issue, please confirm these boxes are checked.
- [x] I have read the wiki page and cheat sheet, but there is no information I need.
- [x] I have searched in existing issues, but did not find a same one.
- [x] I want to report a problem instead of asking a question. It'd better to use kingfisher tag in Stack Overflow to ask a question.
Issue Description
What
In my app I have a collection view with 3 cells (one image per cell). The data of this collection view will be reloaded 3 times in a very short time. This causes Kingfisher to fail setting the image with .notCurrentSourceTask
even if the cell is still the correct one (meaning the task identifier is still "valid").
2019-09-26 10:31:06.440 setImage <UIImageView: 0x7ffcfbe7bce0> <taskIdentifier: 27> <url: URL1>
2019-09-26 10:31:06.442 setImage <UIImageView: 0x7ffcfbe82510> <taskIdentifier: 28> <url: URL2>
2019-09-26 10:31:06.444 setImage <UIImageView: 0x7ffcfbe866a0> <taskIdentifier: 29> <url: URL3>
2019-09-26 10:31:06.446 cancel <UIImageView: 0x7ffcfbe866a0> <taskIdentifier: 29>
2019-09-26 10:31:06.447 setImage <UIImageView: 0x7ffcfbe866a0> <taskIdentifier: 30> <url: URL1>
2019-09-26 10:31:06.447 cancel <UIImageView: 0x7ffcfbe7bce0> <taskIdentifier: 27>
2019-09-26 10:31:06.447 setImage <UIImageView: 0x7ffcfbe7bce0> <taskIdentifier: 31> <url: URL2>
2019-09-26 10:31:06.448 cancel <UIImageView: 0x7ffcfbe82510> <taskIdentifier: 28>
2019-09-26 10:31:06.448 setImage <UIImageView: 0x7ffcfbe82510> <taskIdentifier: 32> <url: URL3>
2019-09-26 10:31:06.525 cancel <UIImageView: 0x7ffcfbe82510> <taskIdentifier: 32>
2019-09-26 10:31:06.526 setImage <UIImageView: 0x7ffcfbe82510> <taskIdentifier: 33> <url: URL1>
2019-09-26 10:31:06.526 cancel <UIImageView: 0x7ffcfbe866a0> <taskIdentifier: 30>
2019-09-26 10:31:06.527 setImage <UIImageView: 0x7ffcfbe866a0> <taskIdentifier: 34> <url: URL2>
2019-09-26 10:31:06.528 cancel <UIImageView: 0x7ffcfbe7bce0> <taskIdentifier: 31>
2019-09-26 10:31:06.529 setImage <UIImageView: 0x7ffcfbe7bce0> <taskIdentifier: 35> <url: URL3>
2019-09-26 10:31:06.537 error <UIImageView: 0x7ffcfbe7bce0> <taskIdentifier: 35> Error while downloading image from url: URL3: imageSettingError(reason: Kingfisher.KingfisherError.ImageSettingErrorReason.notCurrentSourceTask(result: Optional(Kingfisher.RetrieveImageResult(image: <UIImage:0x60000333d440 anonymous {1077, 606}>, cacheType: Kingfisher.CacheType.none, source: Kingfisher.Source.network(VarysCore.UrlResource))), error: nil, source: Kingfisher.Source.network(UrlResource)))
2019-09-26 10:31:06.554 error <UIImageView: 0x7ffcfbe866a0> <taskIdentifier: 34> Error while downloading image from url: URL2: imageSettingError(reason: Kingfisher.KingfisherError.ImageSettingErrorReason.notCurrentSourceTask(result: Optional(Kingfisher.RetrieveImageResult(image: <UIImage:0x60000334d7a0 anonymous {1077, 606}>, cacheType: Kingfisher.CacheType.none, source: Kingfisher.Source.network(VarysCore.UrlResource))), error: nil, source: Kingfisher.Source.network(UrlResource)))
In the log file I logged imageView.kf.setImage()
, imageView.kf.cancelDownloadTask()
and the error from the setImage completion handler. As you can see for each cell the same url is being loaded multiple times before the loading succeeds. The task identifier (imageView.kf.taskIdentifier
) for the failing image views should be still "there", no cancel or set image calls happened meanwhile.
I solved it. It's don't redownload when url is equal. You can ignore it. Source: https://github.com/onevcat/Kingfisher/issues/1262#issuecomment-527268134
I solved it. It's don't redownload when url is equal. You can ignore it. Source: #1262 (comment)
i am facing same, How have you solved it?