Search code examples
uiviewcontrollerswift3segueuistoryboardsegueunwind-segue

Warning: Attempt to present FirstViewController on SecondViewController whose view is not in the window hierarchy


I developed a google sign in and sign out button, both work successfully but when I sign out and try to send back in for the second time. The first view controller does not switch to second view controller?? Please help me solve this problem.

@IBAction func signOutButtonDidTouch(_ sender: Any) {
    // Sign user out of Google 

    let firebaseAuth = FIRAuth.auth()

    do {
        try firebaseAuth?.signOut()
        print("[Google] signing out successful")

        // Performs current view controller transition to SignInViewController
        performSegue(withIdentifier: "signOutSegue", sender: self)



    }catch let signOutError as NSError {
        print("Error signing out: %@", signOutError)
        print("[Google] signing out error")
    }
}

Solution

  • The developer will receive this warning when performing a segue from a view controller that is embedded in container.

    Solution:
    Use segue from the parent of container, not from container's view controller.