Search code examples
iosswiftfacebookfirebasefbsdk

Check if user is logged in to facebook and change viewcontroller


i have been trying the app to check if the user is already logged in or not to Facebook but i need to change the ViewController depending if the user is logged or not, here is what i got, im really confused:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    self.window!.rootViewController = LoginViewController()
    self.window!.makeKeyAndVisible()
    return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
}

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
    return FBSDKApplicationDelegate.sharedInstance().application(application, open: url as URL?, sourceApplication: sourceApplication, annotation: annotation)
}

but, im getting an error message that says Use of unresolved identifier 'LoginViewController'

im really confused and i don't know if im near to achieve what i want.

Thanks.

P.D: this code is in the AppDelegate.swift file


Solution

  • This is not remotely related to Facebook or Firebase as your tag and title says.

    LoginViewController class cannot be resolved in your projects scope. This is either your LoginViewController class is not available in your target. Or the actual file is not inside of your project.

    Check this : 'Use of Unresolved Identifier' in Swift