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

时间:2015-10-06 13:39:11

标签: ios facebook facebook-ios-sdk

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

1 个答案:

答案 0 :(得分: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,
};