Sagar Unagar Sagar Unagar - 1 year ago 226
iOS Question

Unable to connect to FCM

I have followed google sample project to implement notification in iOS, However my app is crashing on following line,

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

The whole function is here to connect with Firebase Cloud Messaging(FCM),

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

Error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[NSData gtm_dataByGzippingData:]: unrecognized selector sent to class 0x10fd1f110'

Please help me! How can I solve this?

Answer Source

go to Build Settings

find 'Other Linker Flags'

add '-ObjC'

this will fix your problem

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download