I am trying to logout from Facebook programmatically without using FBSDKLoginButton
i had search how could I do i found this answer Can we logout facebook programatically but the problem is the FBSession
is deprecated in new iOS FBSDK version
my question is Is there any way to clear the fb session in the new iOS FBSDK version? if there any way to logout from Facebook programmatically? or how could I call the logout action from FBSDKLoginButton
Thanking in advance :)
Log out on the Facebook mobile app On your smartphone, it's also pretty simple to log out. Tap the icon of three parallel lines. Scroll down to the bottom and tap "Log Out." You'll then be prompted to confirm that you wish you log out.
Open the Facebook app. Tap. . Scroll to the bottom and tap Log Out.
You have two methods to logout. First, as suggested by Inder Kumar Rathore
FBSDKLoginManager *loginManager = [[FBSDKLoginManager alloc] init]; [loginManager logOut];
Second is by setting the currentAccessToken to nil
[FBSDKAccessToken setCurrentAccessToken:nil];
@cookiemonsta hope second method works for you.
FBSDKLoginManager
is your need, it has logOut
method but you might have to use your custom login
e.g.
FBSDKLoginManager *loginManager = [[FBSDKLoginManager alloc] init]; [loginManager logInWithReadPermissions:@[@"email"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) { if (error) { // Process error } else if (result.isCancelled) { // Handle cancellations } else { // If you ask for multiple permissions at once, you // should check if specific permissions missing if ([result.grantedPermissions containsObject:@"email"]) { // Do work } } }]; //then logout [loginManager logOut];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With