Alamofire / AlamofireImage

AlamofireImage is an image component library for Alamofire
MIT License
3.99k stars 523 forks source link

af_setImage with placeholder image briefly flashes placeholder image even when image is in cache #377

Closed spnkr closed 4 years ago

spnkr commented 5 years ago

What did you do?

i used af_setImage with a placeholder image and an image url to set the image of a UIView of a UICollectionViewCell. the image url is in the url cache.

What did you expect to happen?

the uiview should have shown the image right away

What happened instead?

instead, the placeholder image flashes up momentarily, and then the actual image appears.

i then quit my app, turned off wifi, and re-opened the app. without internet, the exact same thing happened. which verifies that the image url is, indeed, in the local cache. so the placeholder image shouldn't flash up

Alamofire Environment

Alamofire version: 4.8.2 Alamofire Image version: 3.5.10 Xcode version: 11.0 (11A420a) Swift version: 5.0 Platform(s) running AlamofireImage: iOS 13 and iOS 12.2 macOS version running Xcode: 10.14.6

jshier commented 5 years ago

How are you setting the image in the cell? AlamofireImage checks the cache before setting the placeholder, so you may be getting the flash from a different request being cancelled on cell reuse, or some other event order issue.

cnoon commented 4 years ago

Closing this issue out until we get information back. I'm fairly confident this has something to do with misuse rather than an AFI bug itself.