question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

iOS - Caching Image failures

See original GitHub issue

I am loading 20 images hosted in the USA on a very slow wifi connection (less than 1Mbps) from Asia. In the browser, the images fetch, but its slow.

It seems that FastImage, if the image loading fails (onError is triggered), caches the error instead of trying again later. So when I reload the app, it does not try to refetch the failed images. Only deleting the app and re-launching it again will FastImage be able to fetch the images again.

I don’t know iOS / Swift well enough to confirm my hypothesis, but is anyone else seeing this?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:5
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
evanjmgcommented, Apr 7, 2019

I’m still getting cache misses and/or poor image loading with your fork. Images don’t or take a long time to load with excellent internet. There is definitely a lot less memory being used! Thank you so much for the work so far! It’s definitely an improvement and using your fork is still way better than using React Native Image or the current version

1reaction
StevenMasinicommented, Mar 20, 2019

@KevinColemanInc I think I am experiencing the same issue as you.

You are indeed right, I investigated the issue and right now on iOS when the “ImageCanvas” (I will call it like this) fail to download an image. Well first it fail silently, the error isn’t broadcasted to the RN side, and second it won’t try to download the image again.

So my issue is a bit different than yours. I notice this because in my app I have the same picture being display on several screen, and sometime it loads in some screen but not in others.

e.g I have “ImageCanvas1” on page 1 who failed to download the image, then I push page 2 with “ImageCanvas2” who load successfully the picture. When I pop back to page 1 “ImageCanvas1” still haven’t loaded the picture.

So I have fixed my issue on my own branch but haven’t submit a PR for it yet. Also it’s an iOS related issue, this doesn’t reproduce on Android as Glide will automatically re-trigger the download if it fails.

But as I said your issue is different, and I should made a fix that handle all the scenario.

I will open a new PR for this, and will keep you updated about it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nil while caching images | Apple Developer Forums
I've been able to solve the issue of caching images to improve scroll performance in my app. However nil is found when it...
Read more >
Nil while caching images - ios - Stack Overflow
Show activity on this post. I've been able to solve the issue of caching images to improve scroll performance in my app. However...
Read more >
Reusable Image Cache in Swift | by Maksym Shcheglov
To get an image from cache first we should check for the decoded one as the best-case scenario. Next search for an image...
Read more >
Image - ReactXP - Microsoft Open Source
If headers contains 'Cache-Control: max-stale' with no value specified and the image fails to load, the component tries again passing cache: ...
Read more >
iOS/Swift 5-minute Tips: Easy Image Cache In Swift - YouTube
In this installment of Bear Cahill's 5-minute iOS /Swift Tips Tutorials, Bear discusses how to cache images to help save network usage, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found