在尝试将Googlelogin集成到我的应用中时无法find“GoogleService-Info.plist”

我遵循: 将Googlelogin集成到您的iOS应用程序中

但是,当我执行应用程序,它停在应用程序委托本身 – 即使在我看到我的第一个视图控制器之前。

原因是因为我在"application didFinishLaunchingWithOptions withOptions ”中写的这几行代码,它们是:

 "NSError* configureError; [[GGLContext sharedInstance] configureWithError: &configureError]; NSAssert(!configureError, @"Error configuring Google services: %@", configureError); [GIDSignIn sharedInstance].delegate = self;" 

在debugging中,当它到达这个代码,它说

“终止应用程序由于未捕获的exception'NSInternalInconsistencyException',原因:'错误configuration谷歌服务:错误域= com.google.greenhouse代码= -200”无法configurationGGL。“UserInfo = 0x7ff9c2e1d000 {NSLocalizedRecoverySuggestion =检查格式和GoogleService的位置-Info.plist。,NSLocalizedDescription =无法configurationGGL。,NSLocalizedFailureReason =无法parsing提供的GoogleService-Info.plist。查看日志以获取详细信息。

我将GoogleService-Info.plist放在我的目录中,但仍然无法正常工作。

我面临同样的问题。 而且,实际上,我在cocoapods文件中解决了这个问题,我把“pod”Google / SignIn“”而不是“pod Google”。 希望它可以帮助你。

  1. 您必须将GoogleService-Info.plist文件拖放到您的项目的Shared Resources等位置。 成功添加文件后,还应确保将其包含在项目构build中:

显示添加的资源的图像

  1. 仔细检查一下,在项目的“构build阶段”部分中,您的项目包括GoogleService-Info.plist在这里输入图像说明

  2. 仔细检查文件名称。 文件名必须完全是GoogleService-Info.plist常见的拼写错误,包括GoogleServices-Info.plistGoogleService-info.plist – 区分大小写,并且只能以正确的名字命名。

如果您只想获取GCM_SENDER_ID ,请尝试此解决方法:

 NSError* configureError; [[GGLContext sharedInstance] configureWithError:&configureError]; NSString * gcmSenderID = [GGLContext sharedInstance].gcmSenderID; NSLog(@"%@", gcmSenderID); 

我更新了Google Pod时发生了这种情况。 他们改变了他们configurationURLscheme的方式。 最好的办法是重新configuration谷歌login。