facebookarchive / react-native-fbsdk

A React Native wrapper around the Facebook SDKs for Android and iOS. Provides access to Facebook login, sharing, graph requests, app events etc.
https://developers.facebook.com/docs/react-native
Other
2.99k stars 908 forks source link

'FBSDKCoreKit / FBSDKCoreKit.h' file not found #452

Closed hasnainsakir99 closed 5 years ago

hasnainsakir99 commented 5 years ago

I have created an empty project and setup a Facebook app and configured my plist file with the correct ID when I import the FBSDKCoreKit and FBSDKLoginKit and import the project in my bridging header I get an error saying ''FBSDKCoreKit / FBSDKCoreKit.h' file not foundt'. The error goes away once I take away these lines of code:

import <FBSDKCoreKit/FBSDKCoreKit.h>

liorbraginsky92 commented 5 years ago

I am also getting this issue even I installed FacebookSDK in ~/Documents/FacebookSDK folder. Anyone has any idea?

Jithinag007 commented 5 years ago

this issues coming from latest xcode(10.x) facebook login working with xcode 9.x

noahtallen commented 5 years ago

If you use pods, you can remove the references to the fbsdk lib from the xcode project and instead add:

  pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'
  pod 'FBSDKCoreKit', '4.38'
  pod 'FBSDKLoginKit', '4.38'
  pod 'FBSDKShareKit', '4.38'

to your podfile

SvetoslavSlavov commented 5 years ago

For XCode 10.x the Frameworks folder was missing for me. I created a folder Frameworks in ios folder and add inside Bolts.framework, FBSDKCoreKit.framework, FBSDKLoginKit.framework, FBSDKShareKit.framework. Then i link the libraries again. I go to Link Binary With Libraries remove them and add them again. The other possible issue can be if the Documents directory is in the iCloud. Then the files are not in your computer but they are stored in the cloud. You have to disable the cloud from Settings.

mg4u commented 5 years ago

this issues coming from latest xcode(10.x) facebook login working with xcode 9.x @Jithinag007 So what is the solution to make it works in Xcode 10?

noahtallen commented 5 years ago

The pods solution works in Xcode 10 👍

elhachimi commented 5 years ago

Hi @noahtallen, i don't think leaving
pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk' line and doing pod install is a good idea because it installs React and other dependencies

noahtallen commented 5 years ago

@elhachimi, if you're already linking libraries through Pods which depend on react native, you'd probably already be installing react through pods too. At least in my case, all of my native 3rd party dependencies (including react native) go through pods

elhachimi commented 5 years ago

@noahtallen i noticed that with only pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk' in podfile does also install FBSDKCoreKit, 'FBSDKLoginKit' ...

noahtallen commented 5 years ago

Hmm that's great! I'm not sure if I tested just adding the rn-fbsdk pod without the others, but it'd be great to hear if login still works without those!

arunmenon1975 commented 5 years ago

What finally worked for me was:

I tried all possible variations (with/without pods, different versions of sdks, drag drop linking, consuming React as a pod etc etc) but i was getting one error or the other.

I am on react-native v0.59.10 with react-native-fbsdk at 0.10.1

IAmMarcellus commented 5 years ago

I got this to work by using a variation of @noahtallen 's comment. I also removed the libs from xcode and used pods however I used pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk' pod FacebookSDK instead of the pods that @noahtallen used for the facebook SDK as those are deprecated now. However, to use this setup, react native must at version 0.60.0 or above, because the new SDK doesn't work with earlier versions.

msqar commented 5 years ago

@IAmMarcellus can you help me out please? I'm also using RN 0.60.4 with CocoaPods. Do i need to add the FacebookSDK under my ~/Documents and import the .framework files or that is no longer needed? These are the versions that are installing on my pod install

Analyzing dependencies
Fetching podspec for `react-native-fbsdk` from `../node_modules/react-native-fbsdk`
Downloading dependencies
Installing Bolts (1.9.0)
Installing FBSDKCoreKit (5.3.0)
Installing FBSDKLoginKit (5.3.0)
Installing FBSDKMarketingKit (4.38.0)
Installing FBSDKPlacesKit (5.3.0)
Installing FBSDKShareKit (5.3.0)
Installing FacebookSDK (4.44.1)
Installing React (0.11.0)
Installing react-native-fbsdk (1.0.1)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 5 dependencies from the Podfile and 9 total pods installed.

[!] React has been deprecated

But I keep getting the 'FBSDKCoreKit/FBSDKCoreKit.h' file not found error.

This is my Pods file

# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'

install! 'cocoapods', :deterministic_uuids => false

target 'MyApp' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # rn_path = '../node_modules/react-native'
  # pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
  # pod 'React', path: rn_path, subspecs: [
  #   'BatchedBridge',
  #   'Core'
  # ]

  # Pods for MyApp
  pod 'FacebookSDK'
  pod 'FacebookSDK/LoginKit'
  pod 'FacebookSDK/ShareKit'
  pod 'FacebookSDK/PlacesKit'
  pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'

  target 'MyAppTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    # The following is needed to ensure the "archive" step works in XCode.
    # It removes React & Yoga from the Pods project, as it is already included in the main project.
    # Without this, you'd see errors when you archive like:
    # "Multiple commands produce ... libReact.a"
    # "Multiple commands produce ... libyoga.a"

    targets_to_ignore = %w(React yoga)

    if targets_to_ignore.include? target.name
      target.remove_from_project
    end
  end
end

Any ideas?

RahulLadybirdweb commented 4 years ago

finally worked.

  1. check out if you are using React Native Version >= 0.60 then you can use react-native-fbsdk version >= 1.0.0 other wise you can use react-native-fbsdk version <= 0.10.
  2. run :- react-native link react-native-fbsdk
  3. remove node-module and pods and podfile.lock.
  4. run :- npm i
  5. run :- cd ios pod install
  6. run :- react-native run-android or react-native run-ios