无法连接到FCM

时间:2016-06-01 08:43:24

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

我已经按照谷歌示例项目在iOS中实施通知,但我的应用程序崩溃在以下行,

[[FIRMessaging messaging] connectWithCompletion:^(NSError * _Nullable error)

整个功能用于连接Firebase云消息传递(FCM),

 - (void)connectToFcm {
  [[FIRMessaging messaging] connectWithCompletion:^(NSError * _Nullable error) {
    if (error != nil) 
    {
      NSLog(@"Unable to connect to FCM. %@", error);
    } 
    else 
    {
      NSLog(@"Connected to FCM.");
    }
  }];
}

错误:由于未捕获的异常'NSInvalidArgumentException'而终止应用,原因:'+ [NSData gtm_dataByGzippingData:]:无法识别的选择器发送到类0x10fd1f110'

请帮帮我!我该如何解决这个问题?

2 个答案:

答案 0 :(得分:0)

检查您的pod文件中的平台版本

它会像" 平台:ios,' 8.0' "

将版本更新为9.0,然后运行命令pod install

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
target 'Product Listing' do
  pod 'Firebase/Messaging'
end

答案 1 :(得分:0)

转到构建设置

找到'其他链接标志'

添加'-ObjC'

这将解决您的问题

相关问题