Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import external iOS framework in flutter plugin?

I'm doing a flutter plugin for stream video by using RTSP protocol. I had no problem develop it for Android, but in iOS things are more complex. I have to use an external library (SGPlayer) for getting the player work. I also downloaded the demo that uses this library and seems to work. This library is NOT on Cocoapods and I need to import it directly into the plugin project from my file system. the downloaded and compiled file structure of the plugin that I would like to use looks like this:

External library file structure

My problem is adding the ".framework" extension file correctly to the iOS project in a way that I can use it to develop the flutter plugin (iOS part).

UPDATE: I built the project with the framework by using instructions at this link: https://github.com/flutter/flutter/issues/17978

The problem now is that while compiling the framework it change the umbrella header because, I think, it's not using the framework module.modulemap but another one. The result is that is importing just some header and implementations, and not all.

like image 839
Lorenzo Imperatrice Avatar asked Jan 23 '19 14:01

Lorenzo Imperatrice


People also ask

Can I use Xcode to code in Flutter?

With Xcode, you'll be able to run Flutter apps on an iOS device or on the simulator.

How do I add a platform to my Flutter project?

flutter create . You can simply run this from the root of your Flutter project and it will add the required files for all platforms. If you only want to add support for specific enabled platforms, you can do that by supplying the --platforms argument: flutter create --platforms=web,macos .


1 Answers

1.Place myFramework.framework to iOS plugin folder /ios ex: myPlugin/ios

2.Update iOS plugin file: myPlugin/ios/myPlugin.podspec Adding the below line at the bottom of the file, above 'end'

s.vendored_frameworks = 'myFramework.framework'

In Terminal : cd to myPlugin/example/ios run command

pod install

or

pod update

Now we can find the iOS plugin code by open iOS project (example/ios/Runner.xcworkspace) in XCode and go to

like image 121
geekymano Avatar answered Sep 16 '22 12:09

geekymano