I am trying to logout from Facebook programmatically without using FBSDKLoginButton
i had search how could I do
i found this answer Can we logout facebook pro
For Swift 3 and 4
I would like to use the code mentioned over here, How to logout user using Facebook authentication using Swift and iOS?
where HardikDG mentioned a good answer for logout. what you need to do is add below line before the login happen,
fbLoginManager.loginBehavior = FBSDKLoginBehavior.web
and while logout use below code
FBSDKAccessToken.setCurrent(nil)
FBSDKProfile.setCurrent(nil)
FBSDKLoginManager().logOut()
this works perfectly for me.