Baseflow / flutter_cached_network_image

Download, cache and show images in a flutter app
https://baseflow.com
2.39k stars 633 forks source link

CachedNetworkImage is not loading images on iOS app #766

Open reytum opened 1 year ago

reytum commented 1 year ago

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 commented 1 year ago

Any update on this?

reytum commented 1 year ago

@renefloor Any update on this?

osangma commented 1 year ago

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

kazimdsaidul commented 1 year ago

same issues in IOS 16

flodaniel commented 1 year ago

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);

nicolo-fr commented 1 year ago

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.

ujjwalll commented 1 year ago

Facing same issue, is there any update on this?

omr1k commented 1 year ago

Any Updates? I'm facing the same issue

wemgl commented 10 months ago

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

kennethkwok commented 7 months ago

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.

Yangyang-X commented 4 months ago

Same problem here

xHawk47 commented 3 months ago

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.

chrisvidal commented 2 weeks ago

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

Yangyang-X commented 2 weeks ago

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: @.***>

chrisvidal commented 1 week ago

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