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
Unable to find "GoogleService-Info.plist" while trying to integrate Google Sign-in in my app
提问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.plist
in 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
- You must drag and drop the
GoogleService-Info.plist
file into your project in a location such asShared Resources
. When you have successfully added the file, you should also make sure to include it in the project build:
- 您必须将
GoogleService-Info.plist
文件拖放到项目中的某个位置,例如Shared Resources
. 成功添加文件后,还应确保将其包含在项目构建中:
Double-check that in the "Build Phases" section of your project that your project is including
GoogleService-Info.plist
.Double check the file name. The file name mustbe exactly
GoogleService-Info.plist
common misspellings include GoogleServices-Info.plistand GoogleService-info.plist- case sensitive and exactly named only will work.
在项目的“构建阶段”部分仔细检查您的项目是否包含
GoogleService-Info.plist
.仔细检查文件名。文件名必须完全是
GoogleService-Info.plist
常见的拼写错误,包括GoogleServices-Info.plist和GoogleService-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 方案的方式。最好的方法是重新配置谷歌登录。