简体   繁体   中英

Sign in with different google account Firebase iOS

I am new to iOS and Firebase in general and I'm struggling to find out how I can get the app to show the google oAuth modal when I click the signin button. At the moment, it comes up on the first signup instance, but I have to delete the app to get it working again. This can be a bit cumbersome if someone wants to change google accounts.

// Google Sign In
@IBAction func gooSignInBtn(sender: AnyObject) {
    GIDSignIn.sharedInstance().signIn()
}

When I call sign out, it signs out, but the below modal doesn't show up again. It just automatically signs into the last signed in google account.

Does the try! FIRAuth.auth()!.signOut() try! FIRAuth.auth()!.signOut() function only sign out the member temporarily?

@IBAction func signOut(sender: AnyObject) {
            try! FIRAuth.auth()!.signOut()
            FIRAuth.auth()?.addAuthStateDidChangeListener({ (auth: FIRAuth, user: FIRUser?) in
                if let user = user {
                    // User is signed in.
                    print(user)
                } else {
                    // No user is signed in.
                    print("user signed out")
                }
            })
        }

在此输入图像描述

尝试添加GIDSignIn.sharedInstance().signOut()以进行注销

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM