SDK SDK LAN Login Failed

Note. I am following the tips for local login from Native Facebook Login stops working after SDK update to version 3.14 .

The error is as follows:

2014-10-13 20: 03: 27.378 Registration [1916: 407643] Error Domain = com.facebook.sdk Code = 9 "Access was not granted. Facebook account. Check device settings." UserInfo = 0x1753c630 {NSLocalizedDescription = Access was not granted to Facebook Account. Check device settings. NSLocalizedFailureReason = Facebook account has not been granted access. Check device settings.}

This is the code below:

// RegistrationManager.m

- (void)setupFacebook
{
    FBSessionStateHandler completionHandler = ^(FBSession *session, FBSessionState status, NSError *error) {
        [self sessionStateChanged:session state:status error:error];
    };

    if ([FBSession activeSession].state == FBSessionStateCreatedTokenLoaded)
    {
        // we have a cached token, so open the session
        [[FBSession activeSession] openWithBehavior:FBSessionLoginBehaviorUseSystemAccountIfPresent
                                  completionHandler:completionHandler];
    }
    else
    {
        [self clearAllUserInformation];

        // create a new facebook session
        FBSession *fbSession = [[FBSession alloc] initWithPermissions:@[@"public_profile"]];
        [FBSession setActiveSession:fbSession];
        [fbSession openWithBehavior:FBSessionLoginBehaviorUseSystemAccountIfPresent completionHandler:completionHandler];
    }
}

- (void)clearAllUserInformation
{
    [FBSession.activeSession closeAndClearTokenInformation];
    [FBSession renewSystemCredentials:^(ACAccountCredentialRenewResult result, NSError *error) {
        NSLog(@"%@", error);
    }];
    [FBSession setActiveSession:nil];
}

      

// RegistrationViewController.m

- (IBAction)loginButtonPressed:(id)sender
{
    // If the session state is any of the two "open" states when the button is clicked
    if (FBSession.activeSession.state == FBSessionStateOpen
        || FBSession.activeSession.state == FBSessionStateOpenTokenExtended)
    {
        // Close the session and remove the access token from the cache
        // The session state handler (in the app delegate) will be called automatically
        [FBSession.activeSession closeAndClearTokenInformation];

        // If the session state is not any of the two "open" states when the button is clicked
    } else
    {
        FBSessionStateHandler completionHandler = ^(FBSession *session, FBSessionState status, NSError *error) {
            [registrationManager sessionStateChanged:session state:status error:error];
        };

        // create a new facebook session
        FBSession *fbSession = [[FBSession alloc] initWithPermissions:@[@"public_profile"]];
        [FBSession setActiveSession:fbSession];
        [fbSession openWithBehavior:FBSessionLoginBehaviorUseSystemAccountIfPresent completionHandler:completionHandler];
    }
}

      

When I press the button, it just says

2014-10-13 20: 03: 29.560 Registration [1916: 407643] The meeting is closed 2014-10-13 20: 03: 29.561 Registration [1916: 407643] The user is logged out. 2014-10-13 20: 03: 29.573 Registration [1916: 407643] The user is logged out.

+3


source to share


1 answer


This means that the user who once selected "Not Allowed" in the popup is asking for permission. If he has a Facebook account linked to settings, from now on, every time he tries to login, it will show this error. It won't save Safari or anything else, just show this error. The user should go to Settings → Facebook and set the slider for your app to ON.



+1


source







All Articles