evollu / react-native-fcm

react native module for firebase cloud messaging and local notification
MIT License
1.73k stars 682 forks source link

[IOS] App crashes on Restart with NSInternalInconsistencyException #946

Closed skomatireddy closed 6 years ago

skomatireddy commented 6 years ago

"react-native-fcm": "15.0.2", ios Simuator: ios version 11.2.0 (16G1314) app running in foreground

I am using wix/react-native-navigation. the last function it is calling before app crashes is FCM.enableDirectChannel(); FCM.on(FCMEvent.DirectChannelConnectionChanged, (data) => { console.log(direct channel connected ${data}); }); setTimeout(() => { FCM.isDirectChannelEstablished().then((d) => console.log(d)); }, 1000); }

app crashes only in debug mode with the following error

Fatal Exception: NSInternalInconsistencyException Error when sending event: FCMDirectChannelConnectionChanged with body: true. Bridge is not set. This is probably because you've explicitly synthesized the bridge in RNFIRMessaging, even though it's inherited from RCTEventEmitter.

this is my AppDelegate.m file

screen shot 2018-05-23 at 2 45 56 pm screen shot 2018-05-23 at 2 44 56 pm

Please let me know if I am missing anything.

evollu commented 6 years ago

I see you called FIRConfigure twice?

skomatireddy commented 6 years ago

Sorry for the confusion, its just the screen shot continuation. I have not called it twice, first screen shot ends after return Yes, from there its the second screen shot with the same lines to follow the flow.

evollu commented 6 years ago

is this only happing for FCM.enableDirectChannel()? does notification work fine if you remove that call?

skomatireddy commented 6 years ago

Yes, I am able to generate Tokens and notifications come through fine.. but I am worried if there will be any side effects? and yes it only happens for FCM.enableDirectChannel().

evollu commented 6 years ago

@srikanthumg FCM.enableDirectChannel() is only needed if you want to have back and forth communication with firebase though socket. if you only need receive notifications, you don't need it

skomatireddy commented 6 years ago

Thank you for the clarification.

tuannguyenhoangit commented 5 years ago

For myside, open notification from app killed. Please help.

Fatal Exception: NSInternalInconsistencyException Error when sending event: FCMNotificationReceived with body: { "_actionIdentifier" = "com.apple.UNNotificationDefaultActionIdentifier"; "_completionHandlerId" = "2BD076CB-76CA-4B29-A451-017CBBC05A68"; "_notificationType" = "notification_response"; aps = { alert = { body = "tuan12313: le to display the \"Green Test\" prefix in green.1"; title = "Visitor Message"; }; category = "SHOW_VISITOR_MESSAGES_ACTION"; }; "gcm.message_id" = "0:1556276035386472%db740235db740235"; "google.c.a.e" = 1; "opened_from_tray" = 1; }. Bridge is not set. This is probably because you've explicitly synthesized the bridge in RNFIRMessaging, even though it's inherited from RCTEventEmitter.