Ahd Radwan Ahd Radwan - 4 months ago 96
iOS Question

Logout from Facebook programmatically iOS

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
:)

Answer

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.