简体   繁体   中英

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)

Facebook SDK 4.X with Swift

let loginManager = FBSDKLoginManager()
loginManager.logOut()

For swift 3.0 add below code for logout

let loginManager = LoginManager()
    loginManager.logOut()

Maybe it's late, but try this :

FBSession.activeSession().closeAndClearTokenInformation()

I hope it will help

Logout from Facebook

let fbLoginManager = FBSDKLoginManager()
fbLoginManager.logOut()

Logout from Facebook Swift 5.0

let loginManager = LoginManager()
    loginManager.logOut()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM