Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logout of Facebook in app using Facebook ios SDK

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.For Facebook integration I have added Facebook SDK.Now when Logout button is clicked in my app it has to clear all the credentials of Facebook Account.I have gone for :

-(IBAction)btnlogOutClicked:(id)sender {   [appDelegate fbDidlogout];  } -(void)fbDidlogout {     FBSession* session = [FBSession activeSession];     [session closeAndClearTokenInformation];     [session close];     [FBSession setActiveSession:nil];   } 

But when I again click on button I m redirected directly to my account without going to Facebook Login page.

How can I logout of Facebook?

like image 536
Aaradhya Avatar asked Mar 25 '13 08:03

Aaradhya


People also ask

What is Facebook SDK for iOS?

The Facebook SDK enables: Facebook Login - Authenticate people with their Facebook credentials. Share and Send dialogs - Enable sharing content from your app to Facebook. App Events - Log events in your application.

How do I log into Facebook on iOS?

To start, go to the home screen on your iPhone (Image 1). Click on the dark blue icon with a white “f” on it to access your Facebook account (this is the Facebook application icon). Type in your, previously established, E-mail address and your Facebook password to log into your account (Image 2).


1 Answers

Using new Facebook SDK login kit just write below line and thats it..

[[FBSDKLoginManager new] logOut]; 

If using swift, make sure to have the necessary imports

import FBSDKLoginKit  func logout() {     FBSDKLoginManager().logOut() } 
like image 154
iHulk Avatar answered Oct 06 '22 01:10

iHulk