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

CachedNetworkImage is not loading images on iOS app #766

Open
reytum opened this issue Aug 16, 2022 · 15 comments
Open

CachedNetworkImage is not loading images on iOS app #766

reytum opened this issue Aug 16, 2022 · 15 comments

Comments

@reytum
Copy link

reytum commented Aug 16, 2022

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 reytum changed the title CachedNetworkImage is not loading images on iOS native app CachedNetworkImage is not loading images on iOS app Aug 16, 2022
@reytum
Copy link
Author

reytum commented Aug 30, 2022

Any update on this?

@reytum
Copy link
Author

reytum commented Sep 2, 2022

@renefloor Any update on this?

@osangma
Copy link

osangma commented Sep 7, 2022

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

@kazimdsaidul
Copy link

same issues in IOS 16

@flodaniel
Copy link

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
Copy link

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
Copy link

Facing same issue, is there any update on this?

@omr1k
Copy link

omr1k commented May 14, 2023

Any Updates? I'm facing the same issue

@wemgl
Copy link

wemgl commented Jul 11, 2023

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

@kennethkwok
Copy link

kennethkwok commented Sep 28, 2023

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
Copy link

Same problem here

@xHawk47
Copy link

xHawk47 commented Jan 23, 2024

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
Copy link

chrisvidal commented May 5, 2024

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
Copy link

Yangyang-X commented May 5, 2024 via email

@chrisvidal
Copy link

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

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

No branches or pull requests