配置Google服务时出错:Error Domain = com.google.greenhouse Code = -106缺少预期的子规格

时间:2017-03-09 07:17:32

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

我正在整合Google cloud messaging

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

pod 'Google/CloudMessaging'

我的GoogleService-Info.plist: -

enter image description here

运行工作区时遇到错误: -

  

由于未捕获的异常而终止应用   ' NSInternalInconsistencyException',原因:'配置Google时出错   services:Error Domain = com.google.greenhouse Code = -106" Missing   预期的亚种。" UserInfo = {NSLocalizedDescription =缺少预期   subspecs。

我错过了任何其他依赖的cocoapod或项目设置吗?

1 个答案:

答案 0 :(得分:0)

这是因为您使用GGLContext类来设置Google服务。在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类和硬编码_gcmSenderID删除了从原始文件中的GCM_SENDER_ID键获取的值。

_gcmSenderID = @"778899223344";

但您可以通过在NO文件

中设置为GoogleServices-Info.plist来停用这些服务