【问题标题】:Facebook SDK 4.0 iOS no longer fast switches to the Facebook APP installed on the deviceFacebook SDK 4.0 iOS 不再快速切换到设备上安装的 Facebook APP
【发布时间】:2015-10-06 13:39:11
【问题描述】:

我正在升级到 Facebook SDK 4.6,并且我正在使用以下代码根据 Scruptions 示例应用程序实现新的登录流程:

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

【问题讨论】:

标签: ios facebook facebook-ios-sdk


【解决方案1】:
FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];

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

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,
};

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-02-07
  • 2015-06-11
  • 2014-11-15
  • 1970-01-01
相关资源
最近更新 更多