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

iOS Facebook SDK not initialized #691

Open igorasilveira opened 4 years ago

igorasilveira commented 4 years ago

🐛 Bug Report

The LoginManager callback returns the following "com.facebook.sdk:FBSDKErrorDeveloperMessageKey": "FBSDKGraphRequestConnection cannot be started before Facebook SDK initialized.", therefore, I cannot obtain the accessToken.

To Reproduce

Follow the FacebookSDK iOS installation tutorial.

Expected Behavior

The LoginManager Browser dialog should return with valid access.

Environment

System: OS: macOS 10.15.2 CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 795.28 MB / 16.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 10.17.0 - /usr/local/bin/node npm: 6.13.4 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1 Android SDK: API Levels: 27, 28 Build Tools: 28.0.2, 28.0.3 System Images: android-27 | Google Play Intel x86 Atom IDEs: Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild npmPackages: react: 16.9.0 => 16.9.0 react-native: https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz => 0.61.4 npmGlobalPackages: create-react-native-app: 2.0.2 react-native-cli: 2.0.1

gitforanand commented 4 years ago

paste your pod file and package.json

James1x0 commented 4 years ago

Also bitten by this attempting to use the /me route via graph api. Login button works great and I'm able to get an access token.

    "react-native-fbsdk": "^1.1.2"

@janicduplessis Any ideas?

texuf commented 4 years ago

Did anyone get anywhere on this?

texuf commented 4 years ago

So you need to call this in swift ApplicationDelegate.initializeSDK(launchOptions) first. Show me that in the documentation and I'll buy you a coffee after quarantine is over.

sungsong88 commented 4 years ago

This happens for Expo SDK36+. Try running initializeAsync at the component mount (Actually, any time that's WAY before u run logInWithReadPermissionsAsync. At least a SECOND before!!)

  useEffect(() => {
    Facebook.initializeAsync('12345678912345');
  }, []);