Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Connect SSO not working on some iPhones

I have implemented FBConnect SSO in my iphone application according to this tutorial. I have tested it on two phones so far, one of which lets me use the function just fine, whereas the other phone simply opens up the Facebook app and closes it right away. I am able to establish a valid session, yet the dialog seems to just close on me on one of the ones.
What could be the problem? Any help is much appreciated.

like image 650
Tim Stullich Avatar asked Aug 01 '12 05:08

Tim Stullich


1 Answers

I think that your problem is that you dont have the proper configuration, either in the client side (your app) or in the server side (the FB app configuration). Please, check both things as follows:

Client app:

Make sure that you have introduced the correct FBAppId into your Info.plist as a URL handler. Facebook will try to open the app by using this handler, and if it doesn't work, your app will not be opened.

Plist Config

(replace the XXXXXXXXXX with your FB appID)

Check whether your app (in the appDelegate) handles the custom URL added above:

- (BOOL)handleOpenURL:(NSURL*)url
{
    NSString* scheme = [url scheme];
    NSString* prefix = [NSString stringWithFormat:@"fb%@", facebookAppId];
    if ([scheme hasPrefix:prefix]) {
        return [fb handleOpenURL:url];
    }
    return YES;
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation 
{
    return [self handleOpenURL:url];
}

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url 
{
    return [self handleOpenURL:url];  
}

Server side

Check that you have correctly configured your bundleId in the FB config page. You can check this in https://developers.facebook.com/apps, selecting you app, and then in the edition panel:

FB config

If you have both things correctly configured it should work in any case (with the FBapp installed or Safari based).

like image 112
Angel G. Olloqui Avatar answered Sep 21 '22 03:09

Angel G. Olloqui