How to Solve Can’t Import Dependency Installed With Cocoapods In Flutter?
While installing FBSDK with cocoapods but can’t import it in AppDelegate.swift file for some reason. The FBSDK kit appears in the Xcode project. So in this article, we will go through how to solve the can’t import dependency installed with cocoapods in flutter.
How to Solve the can’t import dependency installed with cocoapods in flutter?
To solve the issue kindly follow the below steps:
- Select your Project Target
- Go to Build Settings.
- Search for Header Search Paths.
- Add this value $(SRCROOT)/Pods with recursive, then Xcode will resolve the path for you.
A screenshot would look like the below:
Can’t import dependency installed with Cocoapods
- Simply use Swift pods like the below:
pod 'FacebookCore' pod 'FacebookLogin' pod 'FacebookShare'
- and then import as normal, like-
import FBSDKLoginKit import FacebookLogin
Once done, do a clean and build (command/⌘ + Shift + K) and Build (command/⌘ + B). Make sure you are using the .xcworkspace file to open the project.
More info on Swift FBSDK here.
- Once you use the Swift pods, you should see these Frameworks in your project.
frameworks
If you still continue to see the error then “Clean the build folder” using command + shift + alt + K.
- I’ll naively suppose you don’t have use_frameworks! in your Podfile. If that’s true, then you have two ways to go from here:
- In your Runner-Bridging-Header.h add #import <FBSDKCoreKit/FBSDKCoreKit.h>, remove import FBSDKCoreKit from AppDelegate.swift and just continue writing the code.
- Add use_frameworks! to your Podfile and run pod install again. That might bring some other issues, but if that works, then I’d suggest it.
Conclusion:
Thanks for being with us on a Flutter Journey !!!
So in this article, we have been through How to solve the can’t import dependency installed with cocoapods in flutter.
Drop us your requirement for the flutter app? We would love to assist you.
Flutter Agency is our portal Platform dedicated to Flutter Technology and Flutter Developers. The portal is full of cool resources from Flutter like Flutter Widget Guide, Flutter Projects, Code libs and etc.
Flutter Agency is one of the most popular online portals dedicated to Flutter Technology and daily thousands of unique visitors come to this portal to enhance their knowledge on Flutter.