Facebook login with expo-facebook crashing on IOS

Please provide the following:

  1. SDK Version: 38
  2. Platforms(Android/iOS/web/all): IOS

I am facing a crash issue when trying to implementing Facebook login using expo in IOS.
Please find my code below:
debugger;

        await Facebook.initializeAsync("<APP-ID>").catch((error)=>{

            alert(`Facebook initializeAsync: ${error}`);

        });

        const result = await Facebook.logInWithReadPermissionsAsync({

            permissions: ["public_profile", "email"],

        }).catch((error)=>{

            alert(`Facebook logInWithReadPermissionsAsync: ${error}`);

        });;

        this.setState({ isLoading: true });

        if (result.type === "success") {

            // Handle successful authentication here

            await Axios.get(

                `https://graph.facebook.com/me?access_token=${result.token}&fields=id,name,email,picture.type(large)`

            ).then(async (response) => {

                console.log(response.data);

                const { picture, name, email, id } = response.data;

                await upsertUserData(0, id, name, email, '', '', '', picture.data.url, 1, 1, Date.now(), response.data);

            }).catch((error) => {

                console.log(error);

                alert(`Facebook Graph API Error: ${error}`);

            }).finally(() => {

                this.setState({ isLoading: false });

            });

        } else {

            // Handle errors here.

            alert(`Facebook type returned: ${type}`);

            this.setState({ isLoading: false });

        }

    } catch ({ message }) {

        alert(`Facebook Login Error: ${message}`);

    }

package.json
“expo”: “^38.0.0”,
“expo-av”: “~8.2.1”,
“expo-constants”: “~9.1.1”,
“expo-facebook”: “~8.2.1”,
“expo-font”: “~8.2.1”,
“firebase”: “7.9.0”,

1 Like

Hey @edotappstore, is the crash occurring in a standalone project or within the Expo client?

Cheers,
Adam

Hi @adamjnav

It works fine when i load it on the expo client. However, the release build on TestFlight seems to be crashing.

1 Like

We’re seeing the same behavior in our standalone iOS build after upgrading to SDK 38.0.8

Update: We were able to resolve this issue by removing FacebookUrlSchemeSuffix from our app.json (and the corresponding value from the FB config)

1 Like

Thanks @nsdub, It worked finally!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.