Facebook SDK 4.0 IOS Swift Log a user out programmatically Facebook SDK 4.0 IOS Swift Log a user out programmatically ios ios

Facebook SDK 4.0 IOS Swift Log a user out programmatically


Ok, here is the thing for anyone needs assistance.I managed to log my users out using FBSDKLoginManager instance

Apparently and i don't know if is it documented or not FBSDKLoginManager watches

FBSDKAccessToken.currentAccessToken()

so

let loginManager = FBSDKLoginManager()loginManager.logOut() // this is an instance function 

Logs the user out, what i misunderstood that logOut is not a class function.

hope that helps someone!


Swifty and simple answer for lazy ones like me:

FBSDKLoginManager().logOut()


For Swift 3 , Facebook SDK 4.16.0: Using Facebook Swift SDK

LoginManager().logOut()