Swift Facebook SDK Logout
Asked Answered
A

5

5

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)
Ardithardme answered 12/11, 2014 at 2:41 Comment(1)
define "doesn't work"Freeload
C
12

Facebook SDK 4.X with Swift

let loginManager = FBSDKLoginManager()
loginManager.logOut()
Corriveau answered 3/8, 2015 at 19:21 Comment(0)
P
3

For swift 3.0 add below code for logout

let loginManager = LoginManager()
    loginManager.logOut()
Pecten answered 21/2, 2017 at 9:51 Comment(0)
P
1

Maybe it's late, but try this :

FBSession.activeSession().closeAndClearTokenInformation()

I hope it will help

Prevenient answered 4/12, 2014 at 9:17 Comment(0)
O
0

Logout from Facebook

let fbLoginManager = FBSDKLoginManager()
fbLoginManager.logOut()
Osteoclasis answered 21/7, 2017 at 6:10 Comment(0)
A
0

Logout from Facebook Swift 5.0

let loginManager = LoginManager()
    loginManager.logOut()
Ashantiashbaugh answered 4/3, 2021 at 12:25 Comment(1)
This does not logout any user.Adenoidal

© 2022 - 2024 — McMap. All rights reserved.