onMessage not called when notification recieved [iOS]

I have the following code in the constructor of my root view:

this.firebase.messaging().onMessage((message) => { console.log("Got Message:"); console.log(message); Alert.alert("Got Message:", JSON.stringify(message)); });

Unfortunately, even though I get the notifications, there is no log or alert when I swipe to open the notification (on iOS) from the lock screen while the app is running in the background. I did log in getInitialNotification as well and get nothing. Am I missing anything?

Update: I tested getInitialNotification and it does fire correctly when the app is closed. However, still nothing while the app is in the foreground or background

Author: Fantashit

2 thoughts on “onMessage not called when notification recieved [iOS]

  1. Hi @chrisbianca, @SteffeyDev,
    I am using react-native-firebase v2.0.5, target iOS version is 9.0 and react-native version is 0.47.0

    My app is crashing every time I get message with error “There is no completion handler with completionhandlerId:”
    This is happening on both onMessage and getInitialNotification.
    I followed above steps and edited imports of RNFirebaseMessaging.h

    The issue seems to be from RNFirebaseMessaging.m line 406.
    I have set callbacks for getInitialNotification and onMessage also. I am not sure what I am missing.
    Can you help me out with this?

  2. @kssujithcj I have same issue: There is no completion handler with completionhandlerId.

    It seems it has to do with subscribing to onMessage on multiple places. If I only subscribe for messages on one place, the error doesn’t pop out.

    Did you find any other workaround, @kssujithcj?

Comments are closed.

onMessage not called when notification recieved [iOS]

I have the following code in the constructor of my root view:

this.firebase.messaging().onMessage((message) => { console.log("Got Message:"); console.log(message); Alert.alert("Got Message:", JSON.stringify(message)); });

Unfortunately, even though I get the notifications, there is no log or alert when I swipe to open the notification (on iOS) from the lock screen while the app is running in the background. I did log in getInitialNotification as well and get nothing. Am I missing anything?

Update: I tested getInitialNotification and it does fire correctly when the app is closed. However, still nothing while the app is in the foreground or background

Author: Fantashit

3 thoughts on “onMessage not called when notification recieved [iOS]

  1. Hi @chrisbianca, @SteffeyDev,
    I am using react-native-firebase v2.0.5, target iOS version is 9.0 and react-native version is 0.47.0

    My app is crashing every time I get message with error “There is no completion handler with completionhandlerId:”
    This is happening on both onMessage and getInitialNotification.
    I followed above steps and edited imports of RNFirebaseMessaging.h

    The issue seems to be from RNFirebaseMessaging.m line 406.
    I have set callbacks for getInitialNotification and onMessage also. I am not sure what I am missing.
    Can you help me out with this?

  2. @kssujithcj I have same issue: There is no completion handler with completionhandlerId.

    It seems it has to do with subscribing to onMessage on multiple places. If I only subscribe for messages on one place, the error doesn’t pop out.

    Did you find any other workaround, @kssujithcj?

  3. Pingback: 토토

Comments are closed.

onMessage not called when notification recieved [iOS]

I have the following code in the constructor of my root view:

this.firebase.messaging().onMessage((message) => { console.log("Got Message:"); console.log(message); Alert.alert("Got Message:", JSON.stringify(message)); });

Unfortunately, even though I get the notifications, there is no log or alert when I swipe to open the notification (on iOS) from the lock screen while the app is running in the background. I did log in getInitialNotification as well and get nothing. Am I missing anything?

Update: I tested getInitialNotification and it does fire correctly when the app is closed. However, still nothing while the app is in the foreground or background

Author: Fantashit

1 thought on “onMessage not called when notification recieved [iOS]

  1. Hi @chrisbianca, @SteffeyDev,
    I am using react-native-firebase v2.0.5, target iOS version is 9.0 and react-native version is 0.47.0

    My app is crashing every time I get message with error “There is no completion handler with completionhandlerId:”
    This is happening on both onMessage and getInitialNotification.
    I followed above steps and edited imports of RNFirebaseMessaging.h

    The issue seems to be from RNFirebaseMessaging.m line 406.
    I have set callbacks for getInitialNotification and onMessage also. I am not sure what I am missing.
    Can you help me out with this?

Comments are closed.