Facebook SDK 4.0 iOS 不再快速切换到设备上安装的 Facebook APP | 珊瑚贝

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];
   
                 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,肯定不会再次登录我的应用程序。

  • 请检查:-stackoverflow.com/a/32712246/988169
  • 这是因为iOS9。


1
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];

尝试从下一个状态设置为 login.loginBehavior:

1
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
typedef NS_ENUM(NSUInteger, FBSDKLoginBehavior)
{
/*!
   not installed on the device, falls back to \\c FBSDKLoginBehaviorBrowser. This is the
default behavior.
*/

   FBSDKLoginBehaviorNative = 0,

/*!
   @abstract Attempts log in through the Safari browser
*/

   FBSDKLoginBehaviorBrowser,

/*!
   @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.
 */

   FBSDKLoginBehaviorSystemAccount,

/*!
   @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.
*/

   FBSDKLoginBehaviorWeb,
};

  • 唯一的问题是,在 SDK 4.6 中不再可能,因为 Facebook 不想要它:stackoverflow.com/questions/32745663/… 但您的回复让我走上了正确的道路。


来源:https://www.codenong.com/32971496/

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_8924.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?