I would like to know what is the best way to bypass the login viewcontroller if the user is logged in already. I have integrated Facebook in my app. I tried to check for the FBSDKAccessToken.currentAccessToken if it is nil or not in the appdelegate class so the app could start either from the loginviewcontroller or not, but it is not working. This is what I tried so far.
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
if ((FBSDKAccessToken.currentAccessToken()) != nil) {
print("it is logged in")
}else{
print("it is not ")
}
// Override point for customization after application launch.
FBSDKLoginButton.classForCoder()
return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
}
Either the user is logged in or not I get the same message. What am I doing wrong? Thank you.