在检查用户通过身份验证时,performSegue无法正常运行FireBase 3/4 [英] performSegue not working FireBase while checking the user is authenticated Swift 3/4

查看:58
本文介绍了在检查用户通过身份验证时,performSegue无法正常运行FireBase 3/4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚完成了一个letsbuildthatapp的教程视频,内容是关于Firebase与社交登录的混合.

I just finish a tutorial video of letsbuildthatapp about firebase mixed with social login.

如果用户已经通过身份验证,我目前正尝试执行segue.

I currently trying to perform a segue if the user is already authenticated.

如果和正在与我认识的segue进行segue之后,我会在我的东西上打印一些东西,因为我正在使用它进行测试.

I print something in my if and just after I performSegue with a segue who I know work because I'm using it for a test.

有我的代码

func verifDejaConnecter() {
    if Auth.auth().currentUser?.uid != nil {
        performSegue(withIdentifier: "segueAccueilToPres", sender: nil)
        print("test")
    } else {
        return
    }
}

mySegue已创建并可以正常工作,但此处未添加任何内容.

mySegue is created and works but nothing append here.

在控制台中,我可以在if ...中看到打印结果,但没有任何变化

In the console I can see the test resulting from the print in the if ... but nothing is mooving

推荐答案

尝试一下:

func verifDejaConnecter() {
  if Auth.auth().currentUser?.uid != nil {
    DispatchQueue.main.async {
      self.performSegue(withIdentifier: "segueAccueilToPres", sender: self)
        print("test")
    }
  } else {
    return
  }
}

这篇关于在检查用户通过身份验证时,performSegue无法正常运行FireBase 3/4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆