0

I am new to the fbsdk but I followed the exact procedure on the Facebook.developers webpage to incorporate the idk to my app. Having said that I still have a problem.

My app gives you the option of log in using a FBSDKLoginButton, you log in and then you can logout with another FBSDKLoginButton inside the app (Reads Logout).

Everything works fine, you log in using your Facebook account, then in the app you press the log out button and it logs you out, also I do a popToViewController to the root view controller where you can access again using your Facebook account or my original app count system.

This is done using the FBSDK login delegate method: loginButtonDidLogOut

The problem is, after login in the app using FB, and then closing the app completely (terminate it), and then open the app again (logs you in right away with your Facebook account), it won't do the popToViewController after you click the logout button inside the app. I don't know why.

Maybe it has something to do with tokens expiring idk.

This is where I declare the second FBSDKLoginButton (so user can Logout later in the app):

FBSDKLoginButton *fbButton = [[FBSDKLoginButton alloc] initWithFrame:CGRectMake(0, 0, thisCell.frame.size.width, thisCell.frame.size.height)];
    [fbButton setBackgroundImage:nil forState:UIControlStateNormal];
    [thisCell addSubview:fbButton];
    [thisCell bringSubviewToFront:fbButton];

    [fbButton setDelegate:self];

(The logout button is inside a UICell, in a UITableView) (The code above is inside my cellForRowAtIndexPath method)

And this are the FBSDK delegate methods I have:

 - (void)loginButton:(FBSDKLoginButton *)loginButton didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result error:(NSError *)error{

}


- (void)loginButtonDidLogOut:(FBSDKLoginButton *)loginButton{

    [self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:0] animated:YES];
}

What could it be? my guess is the delegate methods don't get called after I "successfully" logout of my FB Account.

Remember, this only happens when I terminate the app while still Logged in with FB account and then trying to close it in the app.

4

0 に答える 0