Marc-jean Baptiste
Marc-jean Baptiste

Reputation: 49

Swift Facebook SDK Logout

I have integrated the facebook sdk into my ios app but want to create a custom logout button as i think the uiview logout button the sdk provides does not fit my color scheme. does anyone know how I can run a method to do a facebook logout?

I have tried the following code but it doesn't work

var theFBSession = FBSession.activeSession()
var check = FBSession.closeAndClearTokenInformation(theFBSession)

Upvotes: 5

Views: 7874

Answers (5)

Shahzaib Maqbool
Shahzaib Maqbool

Reputation: 1487

Logout from Facebook Swift 5.0

let loginManager = LoginManager()
    loginManager.logOut()

Upvotes: 0

Vinoth
Vinoth

Reputation: 9734

Logout from Facebook

let fbLoginManager = FBSDKLoginManager()
fbLoginManager.logOut()

Upvotes: 0

Mahesh Kumar
Mahesh Kumar

Reputation: 1104

For swift 3.0 add below code for logout

let loginManager = LoginManager()
    loginManager.logOut()

Upvotes: 3

chemic
chemic

Reputation: 800

Facebook SDK 4.X with Swift

let loginManager = FBSDKLoginManager()
loginManager.logOut()

Upvotes: 12

Kevin ABRIOUX
Kevin ABRIOUX

Reputation: 17685

Maybe it's late, but try this :

FBSession.activeSession().closeAndClearTokenInformation()

I hope it will help

Upvotes: 1

Related Questions