95

I am using the Facebook SDK found here, and am trying the sample that is provided (in the folder FacebookiOSSample).

If I simply replace the AppId here with my specific AppId, then I can no longer Share. (I replaced it in both the AppDelegate file and the info.plist file). I now receive the following error:

FBSDKLog: Invalid use of FBAppCall, fb**** is not registered as a URL Scheme. Did you set 'FacebookUrlSchemeSuffix' in your plist?

Otherwise this works fine with the sample's original AppId which points to something named IFaceTouch.

What could be wrong with the setup of my app, how do I register my AppId?

Jagat Dave
  • 1,643
  • 3
  • 23
  • 30
L. Desjardins
  • 1,465
  • 1
  • 12
  • 22
  • 1
    Note: The answer below that advises you to add fbauth2 to your CFBundleURLSchemes will cause your app to intercept other app's Facebook app-switch login traffic. *DO NOT DO THIS* – Chris Maddern Apr 03 '16 at 22:53
  • If you are trying to resolve "canOpenURL: failed" warnings, those only indicate that the Facebook app is not installed on your device or simulator and can be ignored.' – Binoy jose Sep 12 '16 at 21:48

13 Answers13

253

Follow these three steps:

  1. Create a key called FacebookAppID with a string value, and add the app ID there.
  2. Create a key called FacebookDisplayName with a string value, and add the Display Name you configured in the App Dashboard.
  3. Create an array key called URL types with a single array sub-item called URL Schemes. Give this a single item with your app ID prefixed with fb. This is used to ensure the application will receive the callback URL of the web-based OAuth flow.

The finished .plist should look something like this:

enter image description here

Source Link:

Ravi Patel
  • 5,121
  • 2
  • 25
  • 44
Rafał Sroka
  • 39,540
  • 23
  • 113
  • 143
  • 1
    Okay the problem seemed to be FacebookDisplayName, this was not matching my App Dashboard. Thanks! – L. Desjardins Feb 19 '14 at 23:34
  • 3
    Most case the typo which could cause similar error message, even a mistyped letter with missed upper/lower case. Double check them! – BootMaker Jan 03 '15 at 14:33
  • 5
    @BootMaker Second that - Mine wasn't working because I incorrectly had "URL schemes" instead of "URL Schemes". – Benjamin Martin May 22 '15 at 19:49
  • 1
    You could see a detailed illustration with the updated 2015 version for Xcode 6 here http://stackoverflow.com/a/18480723/1780492 – BootMaker May 24 '15 at 08:20
  • Also be careful to have the FacebookAppID and FacebookDisplayName upper than the URL types. It crashes if not so on SDK 4. – Paul Razvan Berg Nov 24 '16 at 17:40
  • 1
    if someone using Google sign in, then there will be another URL Scheme for the google as well. so there will be two items in the array – Im Batman Aug 21 '19 at 06:43
  • In one URL type you can have more than one URL Scheme (ie. when using different environments) – javi_swift May 21 '20 at 08:30
23

In terms of raw keys and values you should have CFBundleURLTypes and CFBundleURLSchemes

In terms of raw keys and values you should have CFBundleURLTypes and CFBundleURLSchemes. Hope that helps!

clearwater82
  • 1,746
  • 14
  • 9
22

there is another section below the info - URL Types

check that the values there, under the URL Schemes field match the value in the URL types -> URL Schemes in the property list above. (and also match the FacebookAppID)

URL TYPES

Aviram Netanel
  • 12,633
  • 9
  • 45
  • 69
10

For iOS 9

If you have an error: 'LSApplicationQueriesSchemes'

Based on Bear with me answer, you will also have to add those lines:

<key>LSApplicationQueriesSchemes</key>
<array>
   <string>fbauth2</string>
</array>

See this.

You should end up with those lines at the end of your .plist files:

<key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>fb2R3234544534554</string>
            </array>
        </dict>
    </array>
    <key>FacebookAppID</key>
    <string>2R3234544534554</string>
    <key>FacebookDisplayName</key>
    <string>stevejeff</string>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>facebook.com</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
            <key>fbcdn.net</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
            <key>akamaihd.net</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
                <false/>
            </dict>
        </dict>
    </dict>
    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>fbauth2</string>
    </array>
    </dict>
    </plist>

* If you're using v4.6.0 or higher of the SDK, you only need to add:* (Thanks mohsinj)

   <key>LSApplicationQueriesSchemes</key>
      <array>
        <string>fbapi</string>
        <string>fb-messenger-api</string>
        <string>fbauth2</string>
        <string>fbshareextension</string>
   </array>
Community
  • 1
  • 1
JeffersonBe
  • 559
  • 6
  • 10
  • 1
    [UPDATE] Aug - 2016 For "LSApplicationQueriesSchemes" You have to add more items - `LSApplicationQueriesSchemes fbapi fb-messenger-api fbauth2 fbshareextension ` – mohsinj Aug 10 '16 at 16:28
9

1- In Xcode, right-click your project's Info.plist file and select Open As -> Source Code.

2- Insert the following XML snippet into the body of your file just before the final </dict> element.

  <key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>fb{your-app-id}</string>
    </array>
  </dict>
</array>
<key>FacebookAppID</key>
<string>{your-app-id}</string>
<key>FacebookDisplayName</key>
<string>{your-app-name}</string>
<key>LSApplicationQueriesSchemes</key>
<array>
  <string>fbapi</string>
  <string>fb-messenger-share-api</string>
  <string>fbauth2</string>
  <string>fbshareextension</string>
</array>

3- Replace {your-app-id}, and {your-app-name} with your app's App's ID and name found on the Facebook App Dashboard.

Mahgolsadat Fathi
  • 3,107
  • 4
  • 16
  • 34
5

Go to this Link Select Your App, And configure your info.plist

ZAFAR007
  • 3,049
  • 1
  • 34
  • 45
4

Had this issue but was because i missed the prefix fb with the app id for the url scheme section.

jovani
  • 669
  • 8
  • 16
4

If you are using multiple social auth the place URL schema is like as below.

<key>CFBundleURLTypes</key>
<array>
  <dict>
  <key>CFBundleURLSchemes</key>
  <array>
    <string>fb7876940600009</string>
   <string>com.googleusercontent.apps.76235222224-hfvusdel7p8eavfvn</string>
  </array>
  </dict>
</array>
<key>FacebookAppID</key>
<string>7876983017</string>
<key>FacebookClientToken</key>
<string>e29fbf1f15a5b5be028dcb</string>
<key>FacebookDisplayName</key>
<string>xdfxdffmate</string>
Salman
  • 191
  • 9
1

Today i solved this bug by just removing space from FacebookDisplayName.

make sure you don't have any space in FacebookDisplayName

Krutarth Patel
  • 3,407
  • 6
  • 27
  • 54
1

I don't know if your problem is the same as mine. But it took me some time to find it and i will put it here so that it can help anyone.. The problem was that google sign in used the same info.plist attribute name and it was overriding the ones of facebook.. So i could see this in X-Code and put them together, now everything works fine! (URL Types attribute).

Daniel Vilela
  • 587
  • 1
  • 4
  • 19
1

In my case i already had LSApplicationQueriesSchemes and CFBundleURLTypes keys in my info.plist, When I again added them separately in info.plist. it didn't read the second one and doesn't recognize. So add values into the previous LSApplicationQueriesSchemes and CFBundleURLTypes keys solved my issue.

Nasir Khan
  • 723
  • 4
  • 12
  • 24
1

if you used login with google and implemented already put both in same url schema

<key>CFBundleURLTypes</key>
<array>
   <dict>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>https</string>
            <string>fbXXXXXXXXXXXXXX</string> //facebook app id
            <string>com.googleusercontent.apps.XXXXXXXXX-XXXXXXXXXXXXXXX</string> // Google Url Schemal
        </array>
    </dict>
</array>
Rahman Rezaee
  • 1,943
  • 16
  • 24
0

Follow these three steps:

  1. Create a key called FacebookAppID with any string value, and add the app ID there.

  2. Create a key called FacebookDisplayName with a string value, and add the Display Name you configured in the App Dashboard.

  3. Create an array key called URL types with a single array sub-item called URL Schemes. Give this a single item with your app ID prefixed with fb. This is used to ensure the application will receive the callback URL of the web-based OAuth flow.

Final info.plist Final info.plist

result: enter image description here enter image description here Reference: https://github.com/darwin-morocho/flutter-facebook-auth/blob/master/examples/with_provider/ios/Runner/Info.plist