0

The Facebook SDK for iOS come with some sample applications. E.g. FriendPickerSample and SessionLoginSample. In both when I try to login it will remember my previous facebook users. But I don't want that because I want to use it with another facebook user. How do I clear the info Facebook has cached so that login will act the same as the very first time I tried to login on this device with this particular app?

Does facebook cache all its information in the app bundled? And what info does it store and in what files?

Erik Engheim
  • 8,182
  • 4
  • 36
  • 51

2 Answers2

1

You need to remove all the keys stored by facebook once user logs out.

- (void)fbDidLogout
{
  NSLog(@"Logged out of facebook");
  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];
       }
   }
}
Srikanth
  • 1,861
  • 17
  • 29
0
[[FBSession activeSession] close];

[[FBSession activeSession] closeAndClearTokenInformation];
Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179