-
Notifications
You must be signed in to change notification settings - Fork 525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image does not load after being cancelled and instantly reloaded #55
Comments
Hi @MartinChan1, thanks for opening this issue. If there is truly an issue with AlamofireImage here...we certainly want to fix it up! With that said, I've dug heavily through the request and cancellation logic and I can't track down how you would be hitting this edge case. Cancellation should not cause any issues like this. I've created a new test case in b5f5b5e to verify everything works as expected. I'm going to close this issue out for now. If you could submit a sample project that demonstrates the issue, that would be tremendously helpful. If you provide any information that leads us to believe there really is an issue with AlamofireImage directly, then I'll be more than happy to re-open and investigate further. Cheers. 🍻 |
Hi @cnoon I checked the test and the first image url does not match the second url. It only fails if the 2 urls are equal. The first is https://httpbin.org/image/jpeg, the second is https://httpbin.org/image/png |
Oh man apologies @MartinChan1. That's my bad. I'll re-open this issue and continue to investigate this evening. Thanks for catching my mistake! |
Okay @MartinChan1, I managed to get to the bottom problem and fixed the issue in 3dc1390. This ended up being a very difficult issue to figure out how to solve in a backwards compatible manner. The core problem ended up being a race condition in our cancellation logic. We had always assumed you would cancel a download and would restart a different one. After digging into this scenario a bit more, I now realize that was actually a really poor assumption. Our download image logic was relying on the response request to match the current receipt request, otherwise we would early out. That always works if you're switching the images, but it NEVER works if you are reusing the same URL before the main thread has a chance to cycle. Unfortunately, in most If we weren't concerned about backwards compatibility, we would pass the I'll be pushing out a patch release over the next couple of days with this fix. Thanks again for reporting this...much appreciated! 🍻 |
cc @kcharwood for visibility |
Hmmmm...found another flaw in this approach. Reopening. |
Okay, fixed the last remaining issue in a535fff. We cannot store the |
…tarting the same request See Alamofire/AlamofireImage#55 for details
…tarting the same request Alternate Solution See Alamofire/AlamofireImage#55 for details
Great! thanks @cnoon |
imageView.af_setImageWithURL(url)
imageView.af_cancelImageRequest()
imageView.af_setImageWithURL(url)
The real world case we were having was:
Testing on iOS 8 & iOS 9 this fails on simulator and device
The text was updated successfully, but these errors were encountered: