iosswiftflutterframeworkscocoapods

How to use custom .framework with flutter plugin


the problem is I'm getting sharing Module not found

let's say I have

sharing.framework & I have a flutter plugin + flutter project

flutter plugin is inside the flutter project, I want to use sharing.framework inside flutter plugin

I was able to use the sharing.framework inside the whole flutter project but not inside the flutter plugin (module not found)

I added the sharing.framework inside Embed Frameworks & inside Link Binary with libraries (build phases)

the sharing.framework is inside Frameworks folder,

also in my flutter plugin podspec I tried adding

# Add vendored frameworks
s.vendored_frameworks = 'ios/Frameworks/sharing.framework'

# Preserve paths
s.preserve_paths = 'ios/Frameworks/sharing.framework'

# Link the framework to your plugin
s.frameworks = 'sharing'

Please if anyone can help & tell me exactly how to make this


Solution

  • I solved it,

    edit the podspec

    # Add vendored frameworks
    s.vendored_frameworks = 'sharing.framework'
    
    # Preserve paths
    s.preserve_paths = 'sharing.framework'
    
    # Link the framework to your plugin
    s.frameworks = 'sharing'
    

    & put sharing.framework inside the ios folder not inside any sub folder (classes...)