简体   繁体   中英

Facebook SDK 4.0 iOS no longer fast switches to the Facebook APP installed on the device

I'm upgrading to the Facebook SDK 4.6 and I'm implementing the new login flow according to the Scruptions example app using this code:

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

After implementing this the app no longer fast tabs to the Facebook APP installed on the device to ask for the user permissions but rather shows a webpage inside the app where the user can login into Facebook.

Am I using the correct code? Is there a way for me to go into the Facebook APP and have the user confirm the permissions there like in the 3.x SDK, because the user is already logged into the Facebook APP and will surely not login again in my app.

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

try set to login.loginBehavior one from next states:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM