Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook iOS SDK v4.0 Check User Session State

In the new Facebook iOS SDK, the entire login process has been revamped. The old [FBSession activeSession].isOpen trick doesn't work anymore. How can I reliably determine the state of a user's session in the new SDK?

My current thoughts are simply checking if [FBSDKProfile currentProfile] is nil, but that doesn't seem like it would be 100% accurate, or the proper, most direct way to solve this problem.

like image 243
danielmhanover Avatar asked Mar 25 '15 20:03

danielmhanover


1 Answers

There are some changes on v4.0. You can check all of them here: https://developers.facebook.com/docs/ios/upgrading-4.x

In order to check user's session, now you should use [FBSDKAccessToken currentAccessToken].

FBSession.activeSession has been replaced with [FBSDKAccessToken currentAccessToken] and FBSDKLoginManager. There is no concept of session state. Instead, use the manager to login and this sets the currentAccessToken reference.

like image 129
Douglas Ferreira Avatar answered Oct 29 '22 03:10

Douglas Ferreira