使用Facebook ios SDK在应用中注销Facebook [英] Logout of Facebook in app using Facebook ios SDK

查看:151
本文介绍了使用Facebook ios SDK在应用中注销Facebook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的应用程序中集成了Facebook登录,因此用户可以使用我的应用程序帐户和Facebook登录,并进行相应的操作。对于Facebook集成,我添加了Facebook SDK.Now当我的应用程序中点击注销按钮时,清除Facebook帐户的所有凭证。我已经去了:

   - (IBAction)btnlogOutClicked:(id)sender 
{
[appDelegate fbDidlogout];
}
- (void)fbDidlogout
{
FBSession * session = [FBSession activeSession];
[session closeAndClearTokenInformation];
[session close];
[FBSession setActiveSession:nil];


}

但是当我再次点击按钮I m重新定向到我的帐户,而不用进入Facebook登录页面。



如何注销Facebook?

解决方案

使用新的Facebook SDK登录套件,只需在下面写下即可。

  [FBSDKLoginManager new] logOut]; 






如果使用swift,请确保有必要进口

  import FBSDKLoginKit 

func logout(){
FBSDKLoginManager()。logOut )
}


I have integrated Facebook login in my app and therfore user can login with both my app account and also Facebook and do corresponding actions.For Facebook integration I have added Facebook SDK.Now when Logout button is clicked in my app it has to clear all the credentials of Facebook Account.I have gone for :

-(IBAction)btnlogOutClicked:(id)sender
{
  [appDelegate fbDidlogout]; 
}
-(void)fbDidlogout
{
    FBSession* session = [FBSession activeSession];
    [session closeAndClearTokenInformation];
    [session close];
    [FBSession setActiveSession:nil];


}

But when I again click on button I m redirected directly to my account without going to Facebook Login page.

How can I logout of Facebook?

解决方案

Using new Facebook SDK login kit just write below line and thats it..

[[FBSDKLoginManager new] logOut];


If using swift, make sure to have the necessary imports

import FBSDKLoginKit

func logout() {
    FBSDKLoginManager().logOut()
}

这篇关于使用Facebook ios SDK在应用中注销Facebook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆