Skip to content
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 is never set when af_setImageWithURL is called 2 times in a row #17

Closed
damienrambout opened this issue Sep 22, 2015 · 2 comments
Closed
Assignees
Milestone

Comments

@damienrambout
Copy link

I've noticed that images are never set if I call af_setImageWithURL several times.
The following (test) code will always result in only the placeholder image being set.

imageView.af_setImageWithURL(imageURL, placeholderImage: placeholder, filter: AspectScaledToFillSizeFilter(size: imageView.bounds.size))
imageView.af_setImageWithURL(imageURL, placeholderImage: placeholder, filter: AspectScaledToFillSizeFilter(size: imageView.bounds.size))

The first request seems to be successfully cancelled (I get a cancelled error if I set the completion block).

Cheers.

@cnoon
Copy link
Member

cnoon commented Sep 23, 2015

Thank you for reporting @damienrambout! This was certainly a bug. The logic was pretty obvious why the request was being cancelled.

I reworked the main method a bit to ignore duplicate requests that match the active request in bc0e4fb. I also added some tests around this behavior that fail without the patch and succeed with it. I'll push out a release here shortly with this fix.

Thanks again! 🍻

@cnoon cnoon closed this as completed Sep 23, 2015
@cnoon cnoon added this to the 1.1.1 milestone Sep 23, 2015
@dipang90
Copy link

I have use "af_setImageWithURL" but images is not loaded. @cnoon Above problem is resolved?
What is other way to fetch image from url using Alamofire in Swift?

DIpang.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants