ios 尝试在我的应用中集成 Google 登录时找不到“GoogleService-Info.plist”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31294380/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 06:47:18  来源:igfitidea点击:

Unable to find "GoogleService-Info.plist" while trying to integrate Google Sign-in in my app

iosobjective-cxcodegoogle-apigoogle-signin

提问by Karan. S

I have followed : Integrating Google Sign-In into your iOS app

我遵循了:将 Google 登录集成到您的 iOS 应用程序中

However when I execute the app, it halts in the app delegate itself - even before I can see my first view controller.

但是,当我执行应用程序时,它会在应用程序委托本身中停止 - 甚至在我可以看到我的第一个视图控制器之前。

The reason is because of these few lines of code I wrote in the "application didFinishLaunchingWithOptions withOptions", which are:

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

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

 [GIDSignIn sharedInstance].delegate = self;"

In the debug, when it reaches this code, it says

在调试中,当它到达此代码时,它说

"Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error configuring Google services: Error Domain=com.google.greenhouse Code=-200 "Unable to configure GGL." UserInfo=0x7ff9c2e1d000 {NSLocalizedRecoverySuggestion=Check formatting and location of GoogleService-Info.plist., NSLocalizedDescription=Unable to configure GGL., NSLocalizedFailureReason=Unable to parse supplied GoogleService-Info.plist. See log for details.}'".

“由于未捕获的异常‘NSInternalInconsistencyException’而终止应用程序,原因:‘错误配置 Google 服务:错误域=com.google.greenhouse 代码=-200”“无法配置 GGL。” UserInfo=0x7ff9c2e1d000 {NSLocalizedRecoverySuggestion=检查 GoogleService 的格式和位置-Info.plist., NSLocalizedDescription=无法配置 GGL., NSLocalizedFailureReason=无法解析提供的 GoogleService-Info.plist。查看日志了解详情。}'"。

I put the GoogleService-Info.plistin my directory, but it still isn't working.

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

采纳答案by Dmitriy Stupivtsev

I faced the same problem. And, actually, I solved it when in cocoapods file I placed "pod 'Google/SignIn'" instead of "pod Google". Hope it could help you too.

我遇到了同样的问题。而且,实际上,当我在 cocoapods 文件中放置“pod 'Google/SignIn'”而不是“pod Google”时,我解决了这个问题。希望它也能帮到你。

回答by class

  1. You must drag and drop the GoogleService-Info.plistfile into your project in a location such as Shared Resources. When you have successfully added the file, you should also make sure to include it in the project build:
  1. 您必须将GoogleService-Info.plist文件拖放到项目中的某个位置,例如Shared Resources. 成功添加文件后,还应确保将其包含在项目构建中:

Image showing the added resource

显示添加资源的图像

  1. Double-check that in the "Build Phases" section of your project that your project is including GoogleService-Info.plist. enter image description here

  2. Double check the file name. The file name mustbe exactly GoogleService-Info.plistcommon misspellings include GoogleServices-Info.plistand GoogleService-info.plist- case sensitive and exactly named only will work.

  1. 在项目的“构建阶段”部分仔细检查您的项目是否包含GoogleService-Info.plist. 在此处输入图片说明

  2. 仔细检查文件名。文件名必须完全是GoogleService-Info.plist常见的拼写错误,包括GoogleServices-Info.plistGoogleService-info.plist- 区分大小写且仅准确命名才有效。

回答by Rondinelli Morais

If you wanna get only GCM_SENDER_ID, try this workaround:

如果您只想获得GCM_SENDER_ID,请尝试以下解决方法:

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

回答by Sohil

This happens to me when I updated the google pods. They changed the way they configure URL schemes. The best way is to just reconfigure the google signin.

当我更新 google pods 时,这发生在我身上。他们改变了配置 URL 方案的方式。最好的方法是重新配置谷歌登录。