1
I am using facebook sdk 3.1 & FBloginview.So i want to perform logout functionality 
from other view controller..
 Here is my code,

-(void)logout
{
    AppDelegate *appdelegate = [[UIApplication sharedApplication] delegate];

    if (FBSession.activeSession.isOpen) 
    {
        [appdelegate closeSession];       
    }
    [appdelegate openSessionWithAllowLoginUI:NO];
 }

在应用程序委托方法中,

- (void) closeSession
{
    [FBSession.activeSession closeAndClearTokenInformation];
}

所以在closeSession我得到的方法中EXC_BAD_ACCESS

4

1 回答 1

3

在注销按钮上单击删除存储在 facebook 的 userdefault 中的所有密钥

- (void)fbDidLogout
{
  NSHTTPCookie *cookie;
  NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];

  for (cookie in [storage cookies])
  {
      NSString* domainName = [cookie domain];
      NSRange domainRange = [domainName rangeOfString:@"facebook"];
      if(domainRange.length > 0)
      {
          [storage deleteCookie:cookie];
      }
   }
}

或者

Facebook 类已经在其 invalidateSession 函数中包含了 cookie 删除,

这被称为[facebook logout];

于 2012-12-29T10:32:42.560 回答