xcode Swift Facebook SDK 注销

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26878358/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 06:09:38  来源:igfitidea点击:

Swift Facebook SDK Logout

iosxcodeswiftfacebook-ios-sdk

提问by Marc-jean Baptiste

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?

我已将 facebook sdk 集成到我的 ios 应用程序中,但想创建一个自定义注销按钮,因为我认为 sdk 提供的 uiview 注销按钮不适合我的配色方案。有谁知道我如何运行一种方法来进行 facebook 注销?

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

我已经尝试了以下代码,但它不起作用

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

回答by chemic

Facebook SDK 4.X with Swift

带有 Swift 的 Facebook SDK 4.X

let loginManager = FBSDKLoginManager()
loginManager.logOut()

回答by Maishi Wadhwani

For swift 3.0 add below code for logout

对于 swift 3.0,添加以下代码以进行注销

let loginManager = LoginManager()
    loginManager.logOut()

回答by Kevin ABRIOUX

Maybe it's late, but try this :

也许已经晚了,但试试这个:

FBSession.activeSession().closeAndClearTokenInformation()

I hope it will help

我希望它会有所帮助

回答by Vinoth Vino

Logout from Facebook

从 Facebook 注销

let fbLoginManager = FBSDKLoginManager()
fbLoginManager.logOut()