3

I am using the facebook login SDK. It is working perfectly in IOS 7, 8 and 9. But if phone have the facebook app login verification is open the app in iOS 7 AND 8. BUT IOS 9 not open the facebook app. It is open the browser (Web page) and doing the verification. What is the reason? Anybody have any idea?

Edited

 FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
    [FBSDKProfile enableUpdatesOnAccessTokenChange:YES];

    [login logInWithReadPermissions:@[@"public_profile", @"email"]
                 fromViewController:self
                            handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {

                                if (error) {
                                    NSLog(@"Process error");
                                } else if (result.isCancelled) {
                                    NSLog(@"Cancelled");
                                } else {
                                    NSLog(@"Logged in");

                                    [[NSNotificationCenter defaultCenter] postNotificationName:FBSDKProfileDidChangeNotification object:nil];
                                }
                            }];
Puvanarajan
  • 2,786
  • 6
  • 26
  • 37

4 Answers4

4

This is by design and is using SFSafariViewController on iOS 9. As noted in the v4.6 changelog,

The SDK supports various iOS 9 features including Bitcode. In addition, the SDK dialogs such as Login, Like, Share Dialogs automatically determine the best UI based on the device, including SFSafariViewController instead of Safari

We know this may be confusing at first but we definitely have the same goal as our developers to make sure the users get the best experience on iOS 9 and have a good Login experience. On iOS 8, the login will still prefer an app switch to the Facebook app.

Chris Pan
  • 1,903
  • 14
  • 16
1
loginButton.loginBehavior=FBSDKLoginBehaviorWeb;

try this it will open in the in app browser.

0

Yes Puvanarajan have you set permission for iOS 9 facebook login ? if not then set facebook permisiion in info.plist as like below...

enter image description here

hope it will help you.

0

You are using newest SDK, if you want to login through the facebook app that you should use older SDK.
I'm using SDK 4.4 build number 20150708.
Also 20150813 works well.
You can download here: https://developers.facebook.com/docs/ios/downloads Also add some lines to your Info.plist. enter image description here enter image description here

Iraklii
  • 1,295
  • 13
  • 30
  • Don't know why this is downvoted, it serves the purpose (for me atleast). The newest sdk version made it unpredictable if the user would login from Safari VC or the native FB app when it was installed. This made sharing with the logged in user a problem. Looking here: http://stackoverflow.com/questions/32745663/ios-9-facebook-sdk-login-share - Simon Cross mentions "its "by design" in that its a known issue. We're looking at ways to detect, and mitigate this case." Till then, this works for me on iOS 10. – Shawn Frank Nov 15 '16 at 16:04