Type expression is ambiguous without more context in Firebase

 GIDSignIn.sharedInstance.signIn(with: config, presenting: rootViewController()) { user, error in // (The error is showing at the signIn function )

     if let error = error {       // ...       return      }

     guard       let authentication = user.authentication,       let idToken = authentication.idToken      else {       return      }

     let credential = GoogleAuthProvider.credential(withIDToken: idToken,                              accessToken: authentication.accessToken)

Replies

Please format the code with code formatter tool.

GIDSignIn.sharedInstance.signIn(with: config, presenting: rootViewController()) { 
    user, error in // (The error is showing at the signIn function )
     if let error = error {      // ...      return     }
     guard let authentication = user.authentication, let idToken = authentication.idToken  else {      return     }
     let credential = GoogleAuthProvider.credential(withIDToken: idToken, accessToken: authentication.accessToken)

How is rootViewController defined ?

  • Is it the class name (should start with Uppercase)
  • or an instance and then there should not be() rootViewController()

Problem seems to be caused by API change. with: config is no more an argument for GIDSignIn.sharedInstance.signIn.

https://stackoverflow.com/questions/74042206/where-did-configuration-argument-go-from-gidsignin-method