Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

598
Visualizações
How to fix `The user canceled the sign-in flow.` with Sign In with Google on iOS?

I am integrating Sign in with Google with iOS Firebase SDK. When a user taps on the GIDSignIn button, the app shows an alert showing "MyAPP" want to use Google.com for Sign in, but the alert dismisses quickly. The error I get in the didSignInFor user: GIDGoogleUser method as follows:

2019-02-21 16:54:13.104279+0530 MyApp[18743:185089] [Warning] Attempting to load the view of a view controller while it is deallocating is not allowed and may result in undefined behavior (<SFAuthenticationViewController: 0x7fa327945800>)
[DEBUG] Google sign-in error: Error Domain=com.google.GIDSignIn Code=-5 "The user canceled the sign-in flow." UserInfo={NSLocalizedDescription=The user canceled the sign-in flow.}

I have followed the Authenticate Using Google Sign-In on iOS documentation.

I also tried the answer at Google Sign-In crashes on iOS 9 attempting to call canOpenURL, but it is not working.

The AppDelegate implements GIDSignInUIDelegate as well.

If I change the button from GIDSignInButton to UIButton, it works, but the style is lost.

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

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.

over 4 years ago · Santiago Trujillo Relatório

0

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()
}
over 4 years ago · Santiago Trujillo Relatório

0

In Appdelegate try using the below code

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {

    let result = GIDSignIn.sharedInstance().handle(url,
                                                    sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
                                                    annotation: options[UIApplication.OpenURLOptionsKey.annotation])
    return result

}
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda