Facebook iOS SDK 3.1.1 "closeAndClearTokenInformation" method no working

Spencer Müller Diniz picture Spencer Müller Diniz · Oct 15, 2012 · Viewed 10.8k times · Source

I just upgraded from Facebook iOS SDK 3.0.X to 3.1.1, and rewrote some code...

As per Facebook documentation for the logout workflow (https://developers.facebook.com/docs/tutorials/ios-sdk-tutorial/authenticate/#step3), I'm calling the closeAndClearTokenInformation method of the FBSession.activeSession object.

This seems to have no effect on the Facebook session state, because checking it right after the call still returns an open session.

As it stands, once my application logs in with Facebook, it doesn't logout.

[UPDATE 1]

As requested, here's the code I use to check the session state:

if (FBSession.activeSession.state == FBSessionStateCreatedTokenLoaded && FBSession.activeSession.isOpen)
 //logged in
else
 //not logged in

[UPDATE 2]

Changed my logic a bit... Altered my original code to:

if (FBSession.activeSession.isOpen)
 //logged in
else
 //not logged in

Because FBSession.activeSession.state was returning FBSessionStateOpen, not FBSessionStateCreatedTokenLoaded.

Answer

user725840 picture user725840 · Nov 18, 2012

Maybe this will help. https://developers.facebook.com/bugs/497294866962479?browse=search_507cb8ebc4f025673237228

I call all these methods together to make sure it is really logout. Crazy bugs.

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