Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook iOS SDK 4 error info.plist

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

like image 630
Pixel Avatar asked Jun 05 '15 01:06

Pixel


2 Answers

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>
like image 125
OXXY Avatar answered Oct 05 '22 22:10

OXXY


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

like image 27
Aviram Netanel Avatar answered Oct 05 '22 22:10

Aviram Netanel