I have run into an issue using the latest Facebook SDK (4.6) on iOS 9. To authorize a user, I use the FBSDKLoginManager. I have tried setting this:
loginManager.loginBehavior = FBSDKLoginBehaviorNative;
But the SDK still seems to always use an SFSafariViewController to authorize Facebook.
Here is the problem I am facing. If a user has the FB app installed on their device with FacebookAccountA, then tries to authenticate with my app, they are presented this SFSafariViewController and they can authenticate the app with FacebookAccountB (a separate FB account).
Then in the app, I try to share with the following:
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:shareString];
FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init];
dialog.fromViewController = self;
dialog.shareContent = content;
dialog.delegate = self;
[dialog show];
The default setting for the share dialog ends up being the FBSDKShareDialogModeShareSheet. The share sheet presents in the app correctly, and the post seems to work, however the link is posted to FacebookAccountA (the native app account), NOT FacebookAccountB (the one that authenticated with my app).
So, if a user happens to authenticate my app with a different facebook account than they are signed into on their native app, they can end up posting to an account that was different than the one they used to authenticate my app. Is there a way to prevent this?
Thanks in advance.