Google使用Firebase退出按钮

问题描述 投票:0回答:1

我正试图让我的按钮允许用户在点击此按钮时退出他们的Google帐户和Firebase帐户。 firebase网站上提供的注销码目前无效。

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    if indexPath.section == 0 && indexPath.row == 0 {
        print("pressed")
        let firebaseAuth = Auth.auth()
        do {
            try firebaseAuth.signOut()
        } catch let signOutError as NSError {
            print ("Error signing out: %@", signOutError)
        }
    }
ios firebase firebase-authentication
1个回答
1
投票

signOut不会将您的应用程序重定向到登录屏幕,您必须手动执行此操作

  override func tableView(_ tableView: UITableView, didSelectRowAt i  ndexPath: IndexPath) {
    if indexPath.section == 0 && indexPath.row == 0 {
        print("pressed")
        let firebaseAuth = Auth.auth()
        do {
               try firebaseAuth.signOut()
               let vc = self.storyboard?.instantiateViewController(withIdentifier: "loginView")
               self.navigationController?.setViewControllers([vc!], animated: false)
        } catch let signOutError as NSError {
            print ("Error signing out: %@", signOutError)
        }
    }
© www.soinside.com 2019 - 2024. All rights reserved.