Matheus
Matheus

Reputation: 99

How can I get the 'facebookScheme' for iOS in an Expo project?

Expo documentation on expo-facebook says I need to add facebookScheme setting to my app.json file.
To acquire it, the documentation says for me to access the Facebook documentation.
The Facebook documentation says I need to configure a bunch of stuff which requires a Xcode project. For example, configure Info.plist file, or install some dependencies which require Cocoapods.. etc.
But Expo does not expose this file to me, it's an Expo project after all!

What do I do here then? Do I need to associate this Expo project to an Xcode project, somehow? Do I need to eject from Expo?

Just to add some context (which might be relevant or not), the main reason I'm asking this is because when I try to login using Facebook on iOS, my app simply crashes (a SIGABRT error)! I suspect it is because of this missing facebookScheme field.

Thank you

Upvotes: 3

Views: 1766

Answers (2)

saetch_g
saetch_g

Reputation: 1505

For crystal clarity because I'm even dumber than OP, you gotta get whatever the string value is after CFBundleURLSchemes. Literally put the following in your app.json:

{
  "expo": {
    "facebookScheme": "fb<probably_your_fb_appId_here>",
    "facebookAppId": "<definitely_your_fb_appId_here>",
    "facebookDisplayName": "<your_app_name_here>",
    "facebookAutoLogAppEventsEnabled": false,
    "facebookAdvertiserIDCollectionEnabled": false
  },
  "name": "external_login"
}

For a fully functioning app, you're gonna need the other values that come with the app.json too.

Upvotes: 2

Matheus
Matheus

Reputation: 99

So, I'm dumb.

I thought I had to follow the steps mentioned on FB's documentation, but that was not it. I simply had to access it, go straight to step 4 and copy the values CFBundleURLSchemes (which is the facebookScheme I was looking for), FacebookAppID and FacebookDisplayName, then paste then inside app.json file.

Remember to be logged in with your FB dev account and select your FB app on step 1 inside FB's documentation mentioned above.

This solved the issue about my app crashing as soon as I clicked the FB button.

Upvotes: 1

Related Questions