Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't import dependency installed with Cocoapods

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. enter image description here

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: enter image description here 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 and linked frameworks and libraries look like in the project: enter image description here

like image 490
Bram Vanbilsen Avatar asked Jun 28 '17 16:06

Bram Vanbilsen


People also ask

How do I update pod dependency?

Use pod install to install new pods in your project. Even if you already have a Podfile and ran pod install before; so even if you are just adding/removing pods to a project already using CocoaPods. Use pod update [PODNAME] only when you want to update pods to a newer version.

What is CocoaPods dependency?

CocoaPods is a dependency management tool for objective-C projects similar to what Maven's for Java projects, which is written in Ruby and is made of several Ruby Gems. The idea is that once you add the third party libraries to your project you'll no longer need to check if there's any newer versions.

Can I use both CocoaPods and SPM?

Cocoapods + SPM 🚀 Now your library supports both cocoa pods and SPM.


2 Answers

  1. Select your Project Target
  2. Go to Build Settings.
  3. Search for Header Search Paths.
  4. Add this value $(SRCROOT)/Pods with recursive, then Xcode will resolve the path for you.

enter image description here

like image 118
Bryan Norden Avatar answered Oct 26 '22 07:10

Bryan Norden


Are you opening the .xcodeproj or the .xcworkspace? Make sure it is the workspace whenever you install a cocoapod

like image 29
QuantumHoneybees Avatar answered Oct 26 '22 07:10

QuantumHoneybees