I want to contribute in this Flutter_blue plugin project adding the functionalities for native iOS using Objective C framework CoreBluetooth
. How do I import the framework in to the library so I can start using its APIs?
Update:
CoreBluetooth
is not suitable for Flutter
project, because it's not a cocoapod dependency. So what I did what, go to cocopods website and look for other bluetooth dependencies from there. You can also find instructions of how to install a dependency there. For me, I made added pod <depdencyname>
to <plugin-project>/example/ios/Podfile
in the plugin project. Then added dependency: <dependencyname>
to the in <plugin-project>/ios/pubspec
Flutter mobile and desktop apps can use the dart:ffi library to call native C APIs. FFI stands for foreign function interface. Other terms for similar functionality include native interface and language bindings.
I had the same problem for a few time and found a solution by adding this lines to your podspec file at your iOS/ folder in your plugin dir:
s.preserve_paths = 'yourframework.framework'
s.xcconfig = { 'OTHER_LDFLAGS' => '-framework yourframework' }
s.vendored_frameworks = 'yourframework.framework'
Then, on your Flutter project, in the iOS folder, just run pod update
on terminal so it can fetch the new dependencies.
You can find the full issue open by me with this problem here.
If you're looking to add a CocoaPod dependency to the iOS "half" of a Flutter plugin, I believe the correct way to do so is to update the podspec file in the /ios
folder of the plugin source. I recently did some work on the AdMob plugin, for example, and its podspec lists the SDKs for Firebase and Google Mobile Ads:
https://github.com/flutter/plugins/blob/master/packages/firebase_admob/ios/firebase_admob.podspec
And that's how they get included in the build.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With