8

I am using Google Identity Toolkit for federated login in my iOS 9-compatible app. I recently updated all of the frameworks and libraries and started using Cocoapods for dependency management. Now, while Facebook login works fine, when the user taps the "sign in with google" button, the following error is thrown:

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

The configuration code in my AppDelegate where I set the clientID is as follows:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    GITClient *gitkitClient = [GITClient sharedInstance];
    gitkitClient.apiKey = GITKIT_API_KEY;
    gitkitClient.widgetURL = GITKIT_WIDGET_URL;
    gitkitClient.providers = GITKIT_PROVIDERS;
    [GPPSignIn sharedInstance].clientID = GOOGLE_CLIENT_ID;

    ...various unrelated code...
}

Any guidance would be sincerely appreciated.

Hersh Bhargava
  • 615
  • 4
  • 19

3 Answers3

1

As explained at https://developers.google.com/identity/toolkit/ios/quickstart#step_3_set_up_the_quick-start_app, [GIDSignIn sharedInstance].clientID needs to be initialized:

  GITClient *gitkitClient = [GITClient sharedInstance];
  gitkitClient.apiKey = GITKIT_API_KEY;
  gitkitClient.widgetURL = GITKIT_WIDGET_URL;
  gitkitClient.providers = @[ kGITProviderGoogle ];
  [GIDSignIn sharedInstance].clientID = GOOGLE_CLIENT_ID;
Jin Liu
  • 2,203
  • 15
  • 13
  • I actually did have that final line, it just got cut off from the code snippet. Despite having identical code, I am still getting the error. However, I have `GPPSignIn` rather than `GIDSignIn`, if that makes any difference. – Hersh Bhargava Oct 26 '15 at 12:24
  • They are different. Can you try again with GIDSignIn? – Jin Liu Oct 28 '15 at 01:49
  • That variable is not found, I get an error, `Unknown receiver 'GIDSignIn'; did you mean 'GPPSignIn'?` Perhaps this is because I am using GITkit instead of the regular Google+ login framework. – Hersh Bhargava Oct 28 '15 at 08:59
  • If you are using Cocoapod, it should only work with GIDSignIn, which should have been added to your project by Cocoapod as a dependency of Google Identity Toolkit. Have you imported "GoogleSignIn.h"? – Chao Wei Nov 04 '15 at 05:07
0

Have you missed this step -> Add URL schemes to your project?

Search for it in the link https://developers.google.com/identity/sign-in/ios/start-integrating

It has URL schemes that need to be setup. Client ID is one of them.

esh
  • 2,842
  • 5
  • 23
  • 39
0

The answer was actually completely unrelated to the code configuration, and it seems likely that there was a Google-end bug. A new update was released so a few weeks later a simple pod update fixed the problem.

Hersh Bhargava
  • 615
  • 4
  • 19