Facebook iOS SDK 4 error info.plist

6.2k views Asked by At

I'm using the Facebook-iOS-SDK-4 for a FB login but when I try to compile I have this error.

2015-06-05 03:15:02.001 Hooiz[4681:781254] *** Terminating app due to uncaught exception 'InvalidOperationException', reason: 'fb620223481391648 is not registered as a URL scheme. Please add it in your Info.plist'

My .plist is like the Facebook documentation :

enter image description here

3

There are 3 answers

4
OXXY On

Open your info.plist file with text editor you should find it like this

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLName</key>
        <string></string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fb288500927xxxxx</string>
        </array>
    </dict>
</array>
<key>Item 0</key>
<dict>
    <key>CFBundleURLSchemes</key>
    <array>
        <string>fb288500927xxxxxx</string>
    </array>
</dict>
<key>CFBundleVersion</key>
<string>1</string>
<key>FacebookAppID</key>
<string>288500927xxxxxx</string>
<key>FacebookDisplayName</key>
<string>حميتي</string>

Change it to this format (notice the difference between the two format) clean the build and restart XCode. and you are done :)

    <key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLName</key>
        <string></string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fb288500927xxxxxx</string>
        </array>
    </dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>FacebookAppID</key>
<string>288500927xxxxxx</string>
<key>FacebookDisplayName</key>
<string>حميتي</string>
0
Sivajee Battina On

Check your face book app id once again. Add your registered face book app id in your info.plist. And Also add URL Scheme identifier, fbXXXXXXXXXXXX(XXXXXXXXX is your facebook app id which is added previously) to info.plist and check

Hope this helps!!

0
Aviram Netanel On

first, verify that you do the Getting Started instructions correctly.

verify that you add this code to your app delegate:

#import <FBSDKCoreKit/FBSDKCoreKit.h>

- (void)applicationDidBecomeActive:(UIApplication *)application {
  [FBSDKAppEvents activateApp];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  return [[FBSDKApplicationDelegate sharedInstance] application:application
                                  didFinishLaunchingWithOptions:launchOptions];
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
  return [[FBSDKApplicationDelegate sharedInstance] application:application
                                                        openURL:url
                                              sourceApplication:sourceApplication
                                                     annotation:annotation];
}

After that, There is another section below the info - URL Types (and this is where I spent few hours)

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