Attempt to present TabBarController on FBSDKContainerViewController whose view in not in the window hierarchy

86 Views Asked by At

I'm using Facebook login in my app and I'm not able to go to next view after login completed.

i.e. TabBarController its shows an above stated error. I am doing custom login from a button. Here is my code of how I am doing login.

@IBAction func fbLoginBtn(sender: AnyObject) {
    facebookLogin.logInWithReadPermissions(["email","user_friends","user_posts"],fromViewController: self, handler: { (response:FBSDKLoginManagerLoginResult!, error: NSError!) in

        if error != nil {
            print(error.localizedDescription)
            print("Facebook login failed")
        } else {
            let accessToken = response.token.tokenString
            print(accessToken)
            print("Successfully login.\(accessToken)")
            self.performSegueWithIdentifier("showMain", sender: self)
        }
    })
}

After login I'm performing segue to go to next view i.e. TabBarController. If anyone can help please help me. Thank you.

0

There are 0 best solutions below