我试图让我的按钮允许用户在点击此按钮时退出他们的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)
}
}
答案 0 :(得分: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)
}
}