【问题标题】:Google sign out button using Firebase使用 Firebase 的 Google 退出按钮
【发布时间】:2018-02-18 21:16:54
【问题描述】:

我正在尝试让我的按钮允许用户在单击此按钮时退出其 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】:

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)
        }
    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-08-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-06
    • 1970-01-01
    相关资源
    最近更新 更多