IOS - Crash when push notification is clicked on app killed state
RN Version 0.50.4 Device Iphone 7 plus 11.2 foreground,background works fine. I receive the push notifications, I click on them it goes to app fine.
But if we terminate the app -> send push -> click push -> app crashes
I have used it in the exact same way as you have done in the example.
Anyone has a solution?
But if we terminate the app -> send push -> click push -> app crashes
if you terminate app, the app won't trigger any callback when you receive notification. Therefore your app should open to default landing page. However the logic related to initialNotification is triggered because you launch the app though notification. Remove the logic there and see if it keeps crashing
I am facing the same the issue in app kill state. When I click on the notification my app crashes. I tried removing the logic inside initialNotification listener, but the behavior is still same.
@nirajmchauhan try reproduce with example application. or provide a repo that i can access to reproduce
Hi @evollu I'm facing the same issue. Everything works fine in android. Even in ios foreground and minimized state notification works fine but when the app is killed and you try to click the notification then app tries to open but crashes. I'm using non-cocoapod approach.
@rameshbansal there must be some crash log. also try to reproduce with the example project in this repo. or provide a repo so I can reproduce it
Hi @evollu my issue is resolved. I found out if you have connected a remote debugger and then you try to open app by clicking the notification when app is killed then it crashes the app otherwise after disabling remote debugger everything is working fine. Thanks
@evollu i have a simple chat app, upon receiving a push notification when user taps on the notification, app opens and initialNotification is triggered, from there i navigate the user to specific chat to which the notification belongs, so far so good but the problem it that it is keep on navigating to the chat window again again, and eventually i have to kill the app.
There should be some option to remove initial notification once executed. i have tried following things but nothing is working.
FCM.removeAllDeliveredNotifications();
FCM.removeDeliveredNotification(notif["gcm.message_id"]);
this.openThreadNow(notif, navigate);
please reply back ASAP.
@husnaingoldev how about add a flag saying "initNotifHandled"?
I can confirm that @rameshbansal comment works: RN Version 0.54.4 Device iPhone 7, iOS 11.4
Hi I don't understand Ramesh comment about disabling the remote debugger? When I open remote push notifications when the app is in killed (by the user) state, the app opens but is immediately killed. What is the solution?
The same issue. Open notification from app killed. CRASH. Fatal Exception: NSInternalInconsistencyException Error when sending event: FCMNotificationReceived with body: { "_actionIdentifier" = "com.apple.UNNotificationDefaultActionIdentifier"; "_completionHandlerId" = "828BEA51-76E7-4C53-8965-157091B1EA84"; "_notificationType" = "notification_response"; aps = { alert = { body = "tuan12313: nKey.thread.id]11111112"; title = "Visitor Message"; }; category = "SHOW_VISITOR_MESSAGES_ACTION"; }; "gcm.message_id" ="0:1556217872148442%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.