Logout from Facebook programmatically iOS

Ahd Radwan picture Ahd Radwan · Apr 14, 2015 · Viewed 31.5k times · Source

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

mars picture mars · May 16, 2015

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.