【问题标题】:Error configuring Google services: Error Domain=com.google.greenhouse Code=-106 Missing expected subspecs配置 Google 服务时出错:Error Domain=com.google.greenhouse Code=-106 Missing expected subspecs
【发布时间】:2017-07-30 01:32:59
【问题描述】:

我正在整合Google cloud messaging

我通过 cocoapods 安装谷歌云消息。

pod 'Google/CloudMessaging'

我的 GoogleService-Info.plist:-

运行工作区时出现错误:-

由于未捕获的异常而终止应用程序 “NSInternalInconsistencyException”,原因:“配置 Google 时出错 服务:错误域=com.google.greenhouse 代码=-106“缺失 预期的子规范。” UserInfo={NSLocalizedDescription=缺少预期 子规格。

我是否缺少任何其他依赖 cocoapod 或项目设置?

【问题讨论】:

标签: ios objective-c firebase google-cloud-messaging cocoapods


【解决方案1】:

这是因为您使用GGLContext 类来设置谷歌服务。在GoogleServices-Info.plist 中有一些启用的服务,您不包括这些服务。我的情况是IS_SIGNIN_ENABLED = YESIS_ADS_ENABLED = YES

NSError* configureError;                                                     
[[GGLContext sharedInstance] configureWithError:&configureError];            
if (configureError) {                                                        
    RLog(@"Error configuring Google services: %@", configureError);          
    return;                                                                  
}                                                                            

_gcmSenderID = [[[GGLContext sharedInstance] configuration] gcmSenderID];

我也遇到了这个问题,然后我从 Firebase 控制台 下载了GoogleServices-Info.plist。为了解决这个问题,我删除了GGLContext 类,并通过从原始文件中的GCM_SENDER_ID 键获得的值对_gcmSenderID 进行了硬编码。

_gcmSenderID = @"778899223344";

但您可以通过在 GoogleServices-Info.plist 文件中设置为 NO 来禁用这些服务

【讨论】:

    猜你喜欢
    • 2018-05-13
    • 1970-01-01
    • 2016-01-10
    • 2015-10-29
    • 2020-02-03
    • 1970-01-01
    • 2017-06-27
    • 2017-04-10
    • 2016-04-20
    相关资源
    最近更新 更多