iOS: Check if user is already logged in using Facebook?

With latest Facebook SDK, You can check like this :

if FBSDKAccessToken.current() != nil {
    // logged in
}
else {
    // not logged in 
}

They recently changed from FBSDKAccessToken.currentAccessToken() to FBSDKAccessToken.current()


If you're using the Facebook Login SDK, call

FBSDKAccessToken.currentAccessToken()

It will be not nil if the user is logged in.

https://developers.facebook.com/docs/facebook-login/ios/v2.3#token


in sdk for swift 5 use the next portion of code:

import FBSDKCoreKit

if AccessToken.isCurrentAccessTokenActive {
    print("your session is active")
}