问题
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];
}
}];
回答1:
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.
回答2:
loginButton.loginBehavior=FBSDKLoginBehaviorWeb;
try this it will open in the in app browser.
回答3:
Yes Puvanarajan have you set permission for iOS 9 facebook login ? if not then set facebook permisiion in info.plist as like below...
hope it will help you.
回答4:
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.
来源:https://stackoverflow.com/questions/32686934/facebook-login-sdk-in-ios-9