Facebook login promise rejection on iOS

hey all, a solution for people who don’t want to or aren’t ready to upgrade to SDK 36 yet. Apparently the new Expo client (v2.14.1) is set up to only work with the new SDK 36 Facebook module approach. To still be able to use Facebook Login on SDK 35 projects, you have to delete the client from your phone / simulator and then use the expo client:install:ios command from the cli. This will prompt you to install the correct version of the client for your project (i.e. v2.13.0 for SDK 35). This allows you to use Facebook Login again on SDK 35. I assume it’s same for earlier versions of Expo as well.

3 Likes

After update from 35 to 36 with expo update, I’m receiving the current error message

React Native version mismatch.

Javascript version: 0.61.4
Native version: 0.59.8

Does someone have receiving this message also?

The same issue here

Haven’t had this error, but it seems its just as the error says, a RN version mismatch. You are using 0.59 while SDK 36 uses 0.61

Just update your RN version and you should be fine.

Hi, sorry for my bad English, but I had this problem and my solution was that I have to initialize Facebook api. I read this on the documentation Expo SDK 36 is now available. Expo’s Holiday release, 🌟🎄SDK… | by Eric Samelson | Exposition.
This is what I added to my code : Facebook.initializeAsync(FacebookApi.application_id);

Hello I found the solution to this error, the solution is very easy .
1- Delete your folder node_modules of your project

2- In your file app.json
Make sure you had sdk version 36.
"sdkVersion": "36.0.0",

3- In your package.json Make sure you had this update .
"expo": "^36.0.0",
"expo-facebook": "~8.0.0",
"react": "~16.9.0",
"react-devtools": "^3.6.3",
"react-dom": "~16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",
"devDependencies": {
"babel-preset-expo": "~8.0.0",
....
},
Remove "expokit": "^34.0.2" you can install afther .
4- The correct way for initialize the login.

await Facebook.initializeAsync(ConfigApp.facebookAsynConfig.appId);

const { type, token} = await Facebook.logInWithReadPermissionsAsync({
            permissions: ['public_profile', 'email']
          }
        );

5-npm install or yarn install .
npm install work good for me.

Ask any question .

Is this a bug? I am new in expo development. I was under impression, declaring facebook related config in app.json would automatically be placed in Info.plist for iOS. Is it not the case? I am having the same problem when I do not pass in app id explicitly in Facebook.initializeAsync function. I am currently using,

expo-cli: 3.11.5
expo: 36.0.2
expo-facebook: 8.0.0

Hi, I upgraded the expo SDK version to 36.0.0 and invoked the Facebook.intializeAsync(appId) function before calling the logInWithReadPermissionsAsync call but still I am getting this
Error: Facebook SDK has not been initialized yet.
please help, here is my code below

await Facebook.initializeAsync(Constants.manifest.facebookAppId)
const { type, token } = await Facebook.logInWithReadPermissionsAsync({ permissions });

Once after deleted the node modules, ran npm i now works fine. thanks!

Hello, everyone.
I read your valuable messages and those are good help for me.
I am facing this issue on only ios.
It is working well on Android but on ios, I can see this error.

An error occurred Object {
“error”: “Tried to perform Facebook login, but no Facebook app id was provided. Specify Facebook app id in Info.plist.”,
}

Eventhough I added facebook app id on app.json.

"ios": {
     ...
      "infoPlist":{
        "facebookAppId": "XXXXX"
      }
    },

My env:
expo : 35

So I upgraded expo to 36 and add the Facebook.initializeAsync(facebookAppId)

But unfortunately, after upgrading I see this error.

I am confused.

Please let me know which way is best… if there is a good way on sdk 35 or after upgrading to 36, how to this issue solve.

Thanks again.