使用适用于iOS的Google登录时未捕获到的NSInvalidArgumentException [英] Uncaught NSInvalidArgumentException when using Google Sign In for iOS

查看:105
本文介绍了使用适用于iOS的Google登录时未捕获到的NSInvalidArgumentException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天尝试升级到iOS版Google登录(我们已经针对Google+登录构建了一个现有应用).

I tried today to upgrade to Google Sign In for iOS (we have an existing app built against Google+ Sign In).

我按照入门指南进行了配置,并添加了正确的URL方案(例如,应用程序的客户端ID).

I followed the getting started guide to build the configuration out, and added my proper URL schemes (for instance, the app's client ID).

启动应用程序并尝试通过Google登录后,出现以下未捕获的异常:

Upon launching the app and attempting sign in with Google, I get the following uncaught exception:

2015-06-09 03:43:23.800 <appname>[238:7171] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:
'Your app must support the following URL schemes: (null)'

该异常发生在我们控制之外的GIDSignIn.signIn和GIDSignIn.delegate.signIn之间.

The exception occurs outside of our control, between GIDSignIn.signIn and GIDSignIn.delegate.signIn.

有什么我可以解决的吗?

Is there anything I can do to fix this?

推荐答案

发生了什么事,就是Google SDK正在从GoogleService-Info.plist中的词典中检索您的客户端配置,但很可能找不到任何配置或无法查找文件.

What's going on is that the Google SDK is retrieving your client configuration from the dictionary in GoogleService-Info.plist but it most likely is not finding any configurations or is not able to find the file.

致电[[GGLContext sharedInstance] configureWithError: ..时,例如:

NSError* configureError;
[[GGLContext sharedInstance] configureWithError: &configureError];

代码从Google-ServiceInfo.plist文件中解析您的客户端ID,您应该将其添加到supporting files或其他共享资源文件夹中,然后检查您是否还为反向客户端ID添加了URI,将其提取从plist字典中.

The code parses your client ID from the Google-ServiceInfo.plist file, which you should add to a supporting files or other shared resources folder, and then checks that you have also added a URI for the reversed client ID, which is pulled from the plist dictionary.

首先,如果您没有此文件,请按照新的为您的应用启用Google服务页面.

First of all, if you don't have this file, generate it by following the wizard on the new Enable Google services for your app page.

接下来,请确保在build phases部分的Xcode项目中将GoogleService-Info.plist文件复制为资源.成功将其添加到项目中后(通常最好在共享资源"部分中添加),该错误消息将不再表示需要空URI.

Next, make sure that you're copying the GoogleService-Info.plist file as a resource in your Xcode project in the build phases section. When you have successfully added it to your project (usually best added in a Shared Resources section) the error message will no longer indicate a null URI is required.

最后,请确保已在应用程序的URL中添加了捆绑软件ID和反向的客户端ID-这应该很容易做到,因为错误消息会告诉您此时遗漏了什么.

Finally, make sure that you have added the bundle ID and reversed client ID in your application's URLs - which should be easy to do because the error message will tell you what's missing at this point.

如果这一切仍然给您带来麻烦,则您可能需要尝试Google Sign -在iOS上使用快速入门示例,方法是运行:

If all this is still giving you trouble, you might want to try Google Sign-In for iOS using the quickstart sample by running:

pod try Google

然后从SignInExample.xcodeproject示例开始...

And starting from the SignInExample.xcodeproject sample...

这篇关于使用适用于iOS的Google登录时未捕获到的NSInvalidArgumentException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆