iOS 9 Facebook SDK登录/分享 [英] iOS 9 Facebook SDK Login/Share

查看:282
本文介绍了iOS 9 Facebook SDK登录/分享的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iOS 9上使用最新的Facebook SDK(4.6)遇到问题。要授权用户,请使用FBSDKLoginManager。我已经尝试设置这个:

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;

但是,SDK似乎总是使用SFSafariViewController来授权Facebook。

But the SDK still seems to always use an SFSafariViewController to authorize Facebook.

这是我所面临的问题。如果用户使用FacebookAccountA在其设备上安装了FB应用程序,则会尝试使用我的应用程序进行身份验证,他们将被呈现给SFSafariViewController,他们可以通过FacebookAccountB(一个单独的FB帐户)验证该应用程序。

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];

共享对话框的默认设置最后是FBSDKShareDialogModeShareSheet。该分享表在应用程序中正确显示,并且该帖子似乎工作,但该链接发布到FacebookAccountA(本机应用程序帐户),而不是FacebookAccountB(通过我的应用程序认证的)。

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).

所以,如果一个用户碰巧用不同于他们的本地应用程序登录的Facebook帐户验证我的应用程序,他们可以最终发布到一个不同于他们用来认证我的应用程序。有没有办法防止这种情况?

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?

提前感谢

推荐答案

p>这是设计。

在FB SDK v4.6和v3.24中,我们默认使用Safari View Controller,而不是快速应用切换到本机Facebook应用程序。在iOS 9中,快速应用开关流产生两个插页式广告ExampleApp想打开Facebook,Facebook想打开ExampleApp。

In FB SDK v4.6 and v3.24, we default to Safari View Controller rather than fast-app-switching to the native Facebook app. In iOS 9 the fast-app-switch flow generates two interstitials "ExampleApp would like to open Facebook" and "Facebook would like to open ExampleApp".

对于在iOS上登录Safari的数亿人,他们有一个非常棒的体验。

For the hundreds of millions of people who are signed into Safari on iOS, they have an awesome experience.

这篇关于iOS 9 Facebook SDK登录/分享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆