我正试图让我的按钮允许用户在点击此按钮时退出他们的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)
}
}
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)
}
}