Facebook SDK 4.0 iOS no longer fast switches to the Facebook APP installed on the device
我正在升级到 Facebook SDK 4.6,并且我正在根据 Scruptions 示例应用程序使用以下代码实现新的登录流程:
1
2 3 4 5 6 7 8 9 10 |
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login logInWithReadPermissions:@[self.requiredPermission] fromViewController:self handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) { if ([result.grantedPermissions containsObject:self.requiredPermission]) { NSLog (@"Sucess!"); } else { [self dismissViewControllerAnimated:YES completion:NULL]; } }]; |
在实现此功能后,该应用不再快速转到安装在设备上的 Facebook APP 以请求用户权限,而是在应用内显示一个用户可以登录 Facebook 的网页。
我是否使用了正确的代码?有没有办法让我进入 Facebook APP 并让用户确认那里的权限,就像在 3.x SDK 中一样,因为用户已经登录到 Facebook APP,肯定不会再次登录我的应用程序。 尝试从下一个状态设置为 FBSDKLoginBehaviorNative = 0, /*! FBSDKLoginBehaviorBrowser, /*! FBSDKLoginBehaviorSystemAccount, /*! FBSDKLoginBehaviorWeb,
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{
/*!
not installed on the device, falls back to //c FBSDKLoginBehaviorBrowser. This is the
default behavior.
*/
@abstract Attempts log in through the Safari browser
*/
@abstract Attempts log in through the Facebook account currently signed in through
the device Settings.
@note If the account is not available to the app (either not configured by user or
as determined by the SDK) this behavior falls back to //c FBSDKLoginBehaviorNative.
*/
@abstract Attemps log in through a modal //c UIWebView pop up
@note This behavior is only available to certain types of apps. Please check the Facebook
Platform Policy to verify your app meets the restrictions.
*/
};
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/268711.html