React-native-fcm: getInitialNotification is empty

Created on 19 Dec 2016  ·  12Comments  ·  Source: evollu/react-native-fcm

getInitialNotification() returns {} after opening the app by clicking a local notification. How to solve?

Running in IOS simulator in debug mode.

Most helpful comment

@ethan37 fixed in 2.5.5. Please test it out

All 12 comments

try on real device, it does not work on simulator

does the initial notification have any content in data payload?

@evollu nope nothing only an empty object {} . Do you have the same behaviour on the simulator??

oh since it is emulator, I assume it is local notification?

@evollu Yes, unluckily I don't have a physical device to test this package on at the moment.
This is what i tried:

  • run FCM.presentLocalNotification(data) and notification pops up with data.
  • close app from multitasking
  • click on previous notification, FCM.getInitialNotification() returns empty object literal.

Does the same happen to you on the simulator?

it shouldn't be. let me see what is going on. ios only?

I don't know about Android, I've only tested Ios :(

Edit. @evollu https://github.com/evollu/react-native-fcm/issues/89 can be related to this? Seems this issue wasn't solved

After looking into it a little bit more, I found some recurring errors in the console.

This one deserves more attention, happens when i press a notification with app closed/not running in background:

SpringBoard[515] <Error>: *** -[__NSCFCalendar rangeOfUnit:startDate:interval:forDate:]: date cannot be nil
    Future exception.
    A few of these errors are going to be reported with this complaint, then further violations will simply be ignored.
    Here is the backtrace where this occurred this time (some frames may be missing due to compiler optimizations):
    (
        0   CoreFoundation                      0x00000001167b0ef3 -[__NSCFCalendar rangeOfUnit:startDate:interval:forDate:] + 115
    ...

This one seems to happen everytime i click on a notification:

[DataStore] Could not load data at /Users/devmachine/Library/Developer/CoreSimulator/Devices/8A771825-6A90-41DB-AE60-05993F3AA106/data/Library/SpringBoard/PushStore/com.ghostalk.ios.pushstore

looks helpful. this error doesn't show up when you have app running in background?

Yes, sorry, I don't think these two alerts are related to this issue :(

Where is the getInitialNotification data stored before clicking?

@ethan37 fixed in 2.5.5. Please test it out

@evollu Everything works now! ❤

Was this page helpful?
0 / 5 - 0 ratings