flutter_cached_network_image icon indicating copy to clipboard operation
flutter_cached_network_image copied to clipboard

CachedNetworkImage is not loading images on iOS app

Open reytum opened this issue 2 years ago • 20 comments

Overview

I am adding flutter as a module into my existing native iOS and Android application. The issue I am facing is that the image is not loading on iOS. Only the placeholder Image is displaying and not even errorWidget is getting displayed. The same codebase works fine for Android native app. I am using the below version of the library:

cached_network_image: ^3.2.1

Findings

I saw that the library is using flutter_chache_manager internally which internally uses the sqlite plugin. Since our app is also using the sqlite db and AwesomeCache library for iOS ,could it be an issue due to some conflict? This assumption is based on the fact that I created a new sample app in iOS and integrated the same flutter module into that. There it's working fine. The images are loading properly along with the placeholders.

Other things tried

I have tried setting the cacheKey and also a custom cacheManager with a unique key to avoid any conflicts but still no luck. I replaced the CachedNetworkImage with Image.network and its working fine.

Debugging

Below is my code:

             CachedNetworkImage(
                    imageUrl: item["image"] as String,  //debugger stops here
                    imageBuilder: (context, imageProvider) => Container(
                      decoration: BoxDecoration(     //debugger never comes here
                        image: DecorationImage(
                          image: imageProvider,
                          fit: BoxFit.fill,
                        ),
                      ),
                    ),
                    placeholder: (context, url) =>   //debugger stops here
                        Image.asset('assets/images/home.png'),
                    errorWidget: (context, url, error) =>
                        Image.asset('assets/images/img.png'),
              )

Could anyone please help me with this pointing out the places within the library where I could debug the image loading code. Also I tried using Charles Proxy and couldn't find any network call going for those image URLs.

reytum avatar Aug 16 '22 11:08 reytum

Any update on this?

reytum avatar Aug 30 '22 13:08 reytum

@renefloor Any update on this?

reytum avatar Sep 02 '22 16:09 reytum

restart app not hot reload. ios need pod install step.

osangma avatar Sep 07 '22 03:09 osangma

same issues in IOS 16

kazimdsaidul avatar Sep 27 '22 05:09 kazimdsaidul

We are also seeing this issue. I did a lot of debugging and i can trace code execution all the way to file_service.dart:35, which is a dependency from flutter_cache_manager. In all cases where the image is stuck in loading, this line never returns: final httpResponse = await _httpClient.send(req);

flodaniel avatar Oct 18 '22 11:10 flodaniel

Any updates ? Facing the same issue. I'm using cached_network_image: ^3.2.2 Can you reommand alternative/workarounds to cache network image on iOS? Thanks.

nicolo-fr avatar Nov 16 '22 21:11 nicolo-fr

Facing same issue, is there any update on this?

ujjwalll avatar Mar 28 '23 09:03 ujjwalll

Any Updates? I'm facing the same issue

omr1k avatar May 14 '23 20:05 omr1k

I'm also having this issue, but on Android. I'm using 3.2.3.

wemgl avatar Jul 11 '23 12:07 wemgl

I thought this issue also affected me (works fine on Android, but loaded images don't appear on iOS), but upon closer inspection it was down to the fact that the CachedNetworkImage was being wrapped within an InkWell and an Ink widget at some point in the widget tree. Additional note here is that I'm converting the iOS app to fully use Cupertino elements rather than Material.

I'd advise checking along those lines first as I definitely haven't found an alternative library which is currently maintained, which combines caching alongside the functionality of Network.Image.

kennethkwok avatar Sep 28 '23 11:09 kennethkwok

Same problem here

Yangyang-X avatar Jan 01 '24 09:01 Yangyang-X

Same problem.. Works fine on Android platform but images won't load on iOS. I'm trying various approaches, will come back here if something happens to work.

xHawk47 avatar Jan 23 '24 20:01 xHawk47

same issue here. any work around?

would it be caused by the breaking changes in the package cache manager? https://pub.dev/packages/flutter_cache_manager

chrisvidal avatar May 05 '24 09:05 chrisvidal

Restart the app or try another image. That's my case.

On Sun, 5 May 2024 at 17:24, Chris @.***> wrote:

same issue here. any work around?

— Reply to this email directly, view it on GitHub https://github.com/Baseflow/flutter_cached_network_image/issues/766#issuecomment-2094703136, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGMHBPX74GP2NQEAIUJPC73ZAX3FVAVCNFSM56VQWN6KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBZGQ3TAMZRGM3A . You are receiving this because you commented.Message ID: @.***>

Yangyang-X avatar May 05 '24 10:05 Yangyang-X

I had to update the iOS platform to 12.0 and restart everything. thanks

chrisvidal avatar May 06 '24 14:05 chrisvidal