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

前端之家收集整理的这篇文章主要介绍了ios – 配置Google服务时出错:Error Domain = com.google.greenhouse Code = -106缺少预期的子规格前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在整合 Google cloud messaging.

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

pod 'Google/CloudMessaging'

我的GoogleService-Info.plist: –

enter image description here

运行工作区时出错: –

Terminating app due to uncaught exception
‘NSInternalInconsistencyException’,reason: ‘Error configuring Google
services: Error Domain=com.google.greenhouse Code=-106 “Missing
expected subspecs.” UserInfo={NSLocalizedDescription=Missing expected
subspecs.

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

解决方法

这是因为您使用GGLContext类来设置谷歌服务.在GoogleServices-Info.plist中,提供了未包含库的已启用服务.我的情况是IS_SIGNIN_ENABLED = YES和IS_ADS_ENABLED = YES.

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

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

我还遇到了这个问题,然后从Firebase Console下载了GoogleServices-Info.plist.为了解决这个问题,我删除了GGLContext类,并使用从原始文件中的GCM_SENDER_ID键获取的值来硬编码_gcmSenderID.

_gcmSenderID = @"778899223344";

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

猜你在找的iOS相关文章