3

I'm trying to add the Facebook SDK to one of my Flutter projects. In a regular Podfile, it'd look something like this:

  # Pods for facebooklogintest

pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod ‘FBSDKLoginKit’

With "facebooklogintest" being the name of my project. The Podfile in Flutter projects looks a bit different. Is it correct to add the pod files under "# Pods for Runner"?

  # Pods for Runner

pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod ‘FBSDKLoginKit’

I'm getting the following error when I try to install it as shown above:

[!] Invalid `Podfile` file: Please set FLUTTER_FRAMEWORK_DIR to the directory containing Flutter.framework.

Where and to where should I point this file to get rid of this error?

4
  • Please run flutter run -v and post the logs showing the full output from CocoaPods. You may need to pod repo update. Commented Jun 28, 2017 at 12:38
  • @CollinJackson Totally forgot I wasn't running on my own machine. Flutter hadn't been installed yet... But about the podfile itself. Where should I add the facebook pod lines? Commented Jun 28, 2017 at 12:56
  • Hm installed the Flutter and added the variable path etc but still getting the same error when running pod install... Commented Jun 28, 2017 at 13:10
  • Flutter run automatically installed these dependencies for me. And for some reason that did work. Weird! Commented Jun 28, 2017 at 13:15

2 Answers 2

3

Try this :

def fbPods
    pod 'FBSDKCoreKit'
    pod 'FBSDKShareKit'
    pod ‘FBSDKLoginKit’
end

target 'facebooklogintest' do
    fbPods
end

target 'Runner' do
    fbPods
end

Run this command

pod install --no-repo-update
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you, but would it be wrong to just add the facebook pod lines under "Pods for Runner" as shown in the question?
yes you can as same as question but both target have same pod so i have defined at one place .
0

In bash_profile, export FLUTTER_FRAMEWORK_DIR=/flutter/bin/cache/artifacts/engine/ios

source ~/.bash_profile

In iOS folder, pod install

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.