Issues with asset images in pod dependency

Hi there,

I’m trying to integrate a Swift CocoaPod into my Flutter proof of concept app. The pod contains UI components, including UIImages that are kept in the pod’s Assets.xcassets.

Everything related to the pod dependency is working except for the image assets which don’t show up on screen when running the app. They appear in the project when I look at the the Pods folder, but they just won’t load at runtime.

What I’ve tried:

  • Copying the assets from the pod to my project directly worked, but I’d like to avoid doing this.
  • Adding the path to the assets folder in my pubspec.yaml file, but couldn’t find a path that worked
  • Adding the pod as a static library in the Podfile instead of as a dynamic framework, but had issues with other dependencies of the the pod

I’ve created a native iOS Swift project, integrated the same pod there and everything is working fine, so I gather this must be a Flutter specific issue. Maybe Flutter isn’t embedding the image assets properly? Or maybe I’m missing something?

Has anyone else had issues with loading assets when using CocoaPods in a Flutter app? Any pointers are much appreciated.

Replying to my post just in case some else encounters this problem. This is what fixed it for me:

Added use_frameworks! :linkage => :static to the Podfile.

1 Like