Can't import dependency installed with Cocoapods
Solution 1
- 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.
Solution 2
Are you opening the .xcodeproj
or the .xcworkspace
? Make sure it is the workspace whenever you install a cocoapod
Solution 3
I'll naively suppose you don't have use_frameworks!
in you Podfile
. If that's true, than you have two ways to go from here:
In your
Runner-Bridging-Header.h
add#import <FBSDKCoreKit/FBSDKCoreKit.h>
, removeimport FBSDKCoreKit
fromAppDelegate.swift
and just continue writing the code.Add
use_frameworks!
to yourPodfile
and runpod install
again. That might bring some other issues, but if that works, than I'd suggest it.
Solution 4
When you install your pods, you must build your application first. Then your imports stop showing errors.
Solution 5
If you use cocoapods
, it should have generated a *.xcworkspace
file for you. Open this file instead so your project can see the FBSDK
installed and has reference to it.
Comments
-
Bram Vanbilsen almost 2 years
I've installed FBSDK with Cocoapods but can't import it in my AppDelegate.swift file for some reason. The FBSDK kit appears in my Xcode project so I feel like it should be working.
I'm not an iOS developer by any means, I'm just trying to write a simple native plugin for Flutter SDK. Anyone an idea?
--Here is what the pod file looks like--
# Uncomment this line to define a global platform for your project # platform :ios, '9.0' if ENV['FLUTTER_FRAMEWORK_DIR'] == nil abort('Please set FLUTTER_FRAMEWORK_DIR to the directory containing Flutter.framework') end target 'Runner' do use_frameworks! # Pods for Runner pod 'FBSDKCoreKit' pod 'FBSDKLoginKit' pod 'FBSDKShareKit' # Flutter Pods pod 'Flutter', :path => ENV['FLUTTER_FRAMEWORK_DIR'] if File.exists? '../.flutter-plugins' flutter_root = File.expand_path('..') File.foreach('../.flutter-plugins') { |line| plugin = line.split(pattern='=') if plugin.length == 2 name = plugin[0].strip() path = plugin[1].strip() resolved_path = File.expand_path("#{path}/ios", flutter_root) pod name, :path => resolved_path else puts "Invalid plugin specification: #{line}" end } end end post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['ENABLE_BITCODE'] = 'NO' end end end
---EDIT---
I''m getting the following error atm:
FBSDKCoreKit.framework: No such file or directory
.When I open the Frameworks folder in xCode, all file names are in red: But that exact folder in Finder is empty. So I guess that's why the error is showing. The question is how to fix this...This is what my
embedded binaries
andlinked frameworks and libraries
look like in the project: