How to Resolve can’t import dependency installed with cocoapods In Flutter ?

· 3 min read
How to Resolve can't import dependency installed with cocoapods In Flutter
How to Resolve can't import dependency installed with cocoapods In Flutter

When users install 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 walk through How to Resolve can’t import dependency installed with cocoapods In Flutter?

How to Resolve Can’t Import Dependency Installed With Cocoapods In Flutter?

Users can give try to 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.
cocoapods flutter
Cocoapods flutter

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.

You can also 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.

Once you use the Swift pods, you should see these Frameworks in your project.

Resolve can't import dependency installed with cocoapods
Resolve can’t import dependency installed with cocoapods

Conclusion:

In this article, we have been through How to resolve can’t import dependency installed with cocoa pods in flutter?

Thanks for being with us on a Flutter Journey !!!
Keep Learning !!! Keep Fluttering !!!

FlutterAgency.com is our portal Platform dedicated to Flutter Technology and Flutter Developers. The portal is full of cool resources from Flutter like Flutter Widget GuideFlutter ProjectsCode libs, etc.

FlutterAgency.com is one of the most popular online portal dedicated to Flutter Technology and daily thousands of unique visitors come to this portal to enhance their knowledge on Flutter.

Leave a Reply