首页 文章

Google Identity Toolkit无法获取登录客户端ID

提问于
浏览
8

我在iOS 9兼容的应用程序中使用Google Identity Toolkit进行联合登录 . 我最近更新了所有框架和库,并开始使用Cocoapods进行依赖关系管理 . 现在,虽然Facebook登录工作正常,但当用户点击“使用谷歌登录”按钮时,会抛出以下错误:

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

我设置clientID的AppDelegate中的配置代码如下:

- (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...
}

任何指导都将真诚地感谢 .

3 回答

  • 0

    https://developers.google.com/identity/toolkit/ios/quickstart#step_3_set_up_the_quick-start_app所述, [GIDSignIn sharedInstance].clientID 需要初始化:

    GITClient *gitkitClient = [GITClient sharedInstance];
      gitkitClient.apiKey = GITKIT_API_KEY;
      gitkitClient.widgetURL = GITKIT_WIDGET_URL;
      gitkitClient.providers = @[ kGITProviderGoogle ];
      [GIDSignIn sharedInstance].clientID = GOOGLE_CLIENT_ID;
    
  • 1

    你错过了这一步 - > Add URL schemes to your project

    在链接中搜索https://developers.google.com/identity/sign-in/ios/start-integrating

    它具有需要设置的URL方案 . Client ID 就是其中之一 .

  • 0

    答案实际上与代码配置完全无关,似乎有一个Google端错误 . 一个新的更新发布了几个星期后,一个简单的 pod update 解决了这个问题 .

相关问题