Search code examples
iosobjective-cfacebook-loginfacebook-ios-sdk

Clear token in Facebook SDK V4.0.1 for iOS


I am using Facebook Login version 4.0.1 for iOS, and I would like to clear session/ token programatically when I logout of my application. But I am unable to do so. I am importing

#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>

but still I am unable to find a solution. In the previous version we could clear the token from FBSession. But in the new version I am unable to get the FBSession. Please help.

Thanks


Solution

  • If you take a look at the changelog for the FB SDK it states that FBSession and FBAccessTokenData are replaced by FBSDKLoginManager.

    If you then take a look at FBSDKLoginManager, reference, it states that

    FBSDKLoginManager provides methods for logging the user in and out.

    Via this method you should be able to log the user out. Does the login button not automatically change to a logout button when the user is logged in?