Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

You must specify |clientID| for |GIDSignIn| error when trying to sign in with Google

Google sign in was working fine with Xcode 7. After updating to Xcode 8, I started getting the error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'You must specify |clientID| for |GIDSignIn|'. I have a GoogleService-Info.plist file with my CLIENT_ID.

I was able to fix it by adding the following line:

GIDSignIn.sharedInstance().clientID = "<CLIENT_ID>"

It seems the CLIENT_ID isn't being fetched from GoogleService-Info.plist. I've made sure it's in the Copy Bundle Resources.

enter image description here

I shouldn't have to specify the client id in the code. How can I fix it to get the information from the GoogleService-Info.plist file?

like image 669
Daniel Que Avatar asked Sep 27 '16 18:09

Daniel Que


3 Answers

You can do it this way.

Swift:

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

Objective-C:

GIDSignIn.sharedInstance.clientID = FIRApp.defaultApp.options.clientID;
like image 119
Donal Avatar answered Nov 15 '22 20:11

Donal


Please make sure you have these code place in sequence.

FirebaseApp.configure()

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

FirebaseApp.app()?.options.clientID will only able to get data from GoogleService-Info.plist after FirebaseApp.configure() is called.

like image 8
Steven Avatar answered Nov 15 '22 22:11

Steven


I had the same problem. Actually GoogleServices-Info.plist had been updated in my case. I re-downloaded GoogleServices-Info.plist and updated it with the older one which fixed the issue for me.

like image 1
Zeeshan Tufail Avatar answered Nov 15 '22 21:11

Zeeshan Tufail