-
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
ImageDownloader request fails if same request was previously cancelled #121
Comments
Thanks for the detailed write-up here @robmaceachern...much appreciated! 🍻 I've read up on those AFN issues you referenced and I'm sure there is a bug here in AFI. I'll sync with @kcharwood to make sure we get the same fixes in AFI that went into AFN. Once I get into it I'll update the ticket. Thanks again for reporting! |
Shouldn't AlamofireImage continue the download when the download is cancelled and then requested again? I think that's what other image caches do. |
Thanks for putting together this awesome write-up @robmaceachern! Also, huge shout out to our own @kcharwood for tracking everything down in AFN. Huge time saver to a pretty complicated issue. I've managed to use the same approach as @kcharwood to resolve the issue. It's very similar to the same patch we've put in place in the I've added a failing (now passing) test and fixed the core issue in 5505066 and pushed it into Thanks again to everyone involved here! 🍻 |
Agreed @tapz...and that's exactly what it does if the request has already been attached to the URL session. However, if it hasn't, we drop the request altogether and don't ever start it to make way for the new requests coming in. |
…tion. # Conflicts: # Source/ImageDownloader.swift
I think this is basically the same issue as https://github.com/AFNetworking/AFNetworking/issues/3324 and AFNetworking/AFNetworking#3325, so I'll reuse @florianschulz's words:
I've ported his test case with a minor tweak: the
ImageDownloader.maximumActiveDownloads
is configured to always be less than the count of URLs we're testing.This fails using Xcode 7.3.1 testing against iOS 9.3 with AlamofireImage 2.4.0. I'm running into this problem when using the UIImageView extension on a collection view: certain collection view reloads or changes trigger this case which leaves some cells without an image.
I think the problem is that it is currently possible to append an
operation
to aresponseHandler
that has been cancelled. eg inresponseHandler.operations.append(id: receiptID, filter: filter, completion: completion)
.I just found a better test case in AFNetworking that ensures the original requests cancel properly too: https://github.com/AFNetworking/AFNetworking/blob/master/Tests/Tests/AFImageDownloaderTests.m#L369
The text was updated successfully, but these errors were encountered: