0

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.

Petrescu Silviu
  • 247
  • 1
  • 11

1 Answers1

1
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,
};
gaRik
  • 607
  • 6
  • 10
  • The only issue is that in SDK 4.6 it's no longer possible because Facebook doesn't want it: http://stackoverflow.com/questions/32745663/ios-9-facebook-sdk-login-share but your response put me on the right path. – Petrescu Silviu Oct 06 '15 at 16:05