How to fix `The user canceled the sign-in flow.` with Sign In with Google on iOS?
I also faced the issue before. The GIDSignInButton
object don't need addTarget
in code or linking @IBAction
. The GIDSignInButton
class already handle that action for us.
If you are trying to to run GIDSignIn.sharedInstance()?.signIn()
in @IBAction
. You can run GIDSignIn.sharedInstance()?.presentingViewController = self
just before signIn instead of insideviewDidLoad()
.
@IBAction func googleLogin(_ sender: UIButton) {
GIDSignIn.sharedInstance()?.presentingViewController = self
GIDSignIn.sharedInstance()?.signIn()
}