在登录屏幕上无法工作的segue在swift中更新个人资料



我使用Swift2,并在我的应用程序中使用Facebook登录(以Firebase为后端)。在登录屏幕上,一旦用户选择FB登录,我想用一些额外的信息更新用户配置文件,并将其存储在Firebase中。而到控制器的segue更新一些信息。从不露面。日志告诉我facebook账户信息被正确检索但是这个segue

self.performSegueWithIdentifier("completeProfile", sender: nil)

从不工作。我在segue上设置了正确的标识符。

    @IBAction func facebookLogin(sender: AnyObject) {
    AppUtility.loginWithFacebook { (success) in
        if success {
            AppUtility.getUserData({ (success) in
                if success {
                    ApplicationDelegate.showTabBarController()
                }
                else {
                    print ("Attempting FB Login - 5 ")
                    self.performSegueWithIdentifier("completeProfile", sender: nil)
                    print ("Attempting FB Login - 6 ")
                }
            })
        }
    }
}
有趣的是,这会让segue显示:
@IBAction func facebookLogin(sender: AnyObject) {
    AppUtility.loginWithFacebook { (success) in
                    self.performSegueWithIdentifier("completeProfile", sender: nil)
        if success {
            AppUtility.getUserData({ (success) in
                if success {
                    ApplicationDelegate.showTabBarController()
                }
                else {
                    print ("Attempting FB Login - 5 ")
                    print ("Attempting FB Login - 6 ")
                }
            })
        }
    }
}

您应该像这样将它放在成功案例中:

@IBAction func facebookLogin(sender: AnyObject) {
AppUtility.loginWithFacebook { (success) in
    if success {
        AppUtility.getUserData({ (success) in
            if success {
                self.performSegueWithIdentifier("completeProfile", sender: nil)
ApplicationDelegate.showTabBarController()
            }
            else {
                print ("Attempting FB Login - 5 ")
                print ("Attempting FB Login - 6 ")
            }
        })
    }
}

但我不确定你是否想要showTabBarController在同一块

最新更新