0

I have integrated Facebook login in my app and therfore user can login with both my app account and also Facebook and do corresponding actions.

  -(IBAction)FacebooklogoutBtnClick:(id)sender
  {
      FBSDKLoginManager *loginManager = [[FBSDKLoginManager alloc] init];
      [loginManager logOut];
  }
Rohit suvagiya
  • 1,005
  • 2
  • 12
  • 40
  • possible duplicate of [Logout from Facebook programmatically iOS](http://stackoverflow.com/questions/29623191/logout-from-facebook-programmatically-ios) – Pawan Rai Jun 30 '15 at 10:03

2 Answers2

2

just write below line and thats it..

[[FBSDKLoginManager new] logOut];

OR

[FBSDKAccessToken setCurrentAccessToken:nil];
[FBSDKProfile setCurrentProfile:nil];

OR

FBSDKLoginManager *logMeOut = [[FBSDKLoginManager alloc] init];
[logMeOut logOut];
sohil
  • 818
  • 2
  • 15
  • 38
1

you can use

 if ([FBSDKAccessToken currentAccessToken]) {
    FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
            [login logOut];
 }

or you can use FBSession for this if you are using FBSession

  [FBSession.activeSession closeAndClearTokenInformation];
  [[FBSession activeSession] close];
  [[FBSession activeSession] closeAndClearTokenInformation];
  [FBSession setActiveSession:nil];