For a more convenient and standard code in swift, you can use this next piece of code. BTW I am using Swift 2.2 and Xcode 7.3.1.
if let loggedInUsingFBTokenCheck = FBSDKAccessToken.currentAccessToken(){ //User is already logged-in. Please do your additional code/task. }else{ //User is not logged-in. Allow the user for login using FB. }
If you want to load a specific viewController during application startup based on login verification, you can put this code in your AppDelegate project and check inside -
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
Thanks.
onCompletion
source share