swift 4 firebase google sign in exception

500 Views Asked by At

I am trying to use firebase google sign in. I have created a view that I set the class to GIDSignInButton. I attached an outlet to it in the view controller, but when I run the app and click on the GIDSignInButton, the app crashes with:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'You must specify |clientID| for |GIDSignIn|'

Does anyone know how to fix this?

1

There are 1 best solutions below

0
Sanjukta On

Please try this code in didFinishLaunchingWithOptions method in AppDelegate class:

      GIDSignIn.sharedInstance().clientID = FirebaseApp.app()?.options.clientID
      GIDSignIn.sharedInstance().delegate = self

If you not use firebase then you can write:

GIDSignIn.sharedInstance().clientID = "your client id present in googleservice .plist file"
GIDSignIn.sharedInstance().delegate = self

It may helps you. Thank you.