简体   繁体   English

如何从iOS SDK中的Facebook注销

[英]how can logout from facebook in ios sdk

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. 我已经在应用程序中集成了Facebook登录名,因此用户可以同时使用我的应用程序帐户和Facebook登录并执行相应的操作。

  -(IBAction)FacebooklogoutBtnClick:(id)sender
  {
      FBSDKLoginManager *loginManager = [[FBSDKLoginManager alloc] init];
      [loginManager logOut];
  }

just write below line and thats it.. 只需在下面写一行即可。

[[FBSDKLoginManager new] logOut];

OR 要么

[FBSDKAccessToken setCurrentAccessToken:nil];
[FBSDKProfile setCurrentProfile:nil];

OR 要么

FBSDKLoginManager *logMeOut = [[FBSDKLoginManager alloc] init];
[logMeOut logOut];

you can use 您可以使用

 if ([FBSDKAccessToken currentAccessToken]) {
    FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
            [login logOut];
 }

or you can use FBSession for this if you are using FBSession 或者如果您正在使用FBSession,则可以为此使用FBSession

  [FBSession.activeSession closeAndClearTokenInformation];
  [[FBSession activeSession] close];
  [[FBSession activeSession] closeAndClearTokenInformation];
  [FBSession setActiveSession:nil];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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