WARNING: IF YOU IGNORE THIS TEMPLATE, WE'LL IGNORE YOUR ISSUE. YOU MUST FILL THIS IN!
Provide a general summary of the issue.
cordova -v
): 7.0.1cordova platform ls
): 4.4.0_App should not crash_
_App crashes_
_Reproduce this issue; include code to reproduce, if relevant_
_I've added following code_
cordova.plugins.notification.local.schedule({
id: 1,
text: "Countdown finished",
sound: null, // also tried without null and without key
at: end.toDate() // this is a valid date Object passed trough from moment.js
});
Two things: The notification is triggered in background mode and foreground mode. As long as the scheduled timer wasn't reach, everything is fine. It even fires the notification without any problem. But as soon as I push the home button (putting app an background) and reopening the app, it crashs. This happens only after the schedule was fired. As long as I open the app on Schedule everything is fine, but after the second round, it crashed
_Send a Local Notification when giving timer was reached_
2017-06-20 15:03:12.263333+0200 App [1034:586664] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull doubleValue]: unrecognized selector sent to instance 0x1aea6bef8'
* First throw call stack:
(0x188902fe0 0x187364538 0x188909ef4 0x188906f54 0x188802d4c 0x100055408 0x1000558f8 0x100055730 0x100055574 0x100057fa8 0x100052ca8 0x10004dd48 0x100475a50 0x100475a10 0x100483990 0x100485630 0x10048539c 0x1879c3100 0x1879c2cac)
libc++abi.dylib: terminating with uncaught exception of type NSException
I just found out that happens due to my "resume" listener, which adds an invalid date to the localnotification. So basically, the app crashes, when "at" is not valid. There should be a catch to prevent the app crash due to a wrong date.
fixed it for me:
if(end.isValid()) { // isValid is a function from moment.js
cordova.plugins.notification.local.schedule({
id: 1,
text: "YAY! Die Wartezeit ist vorr眉ber!",
sound: null,
at: end.toDate()
});
}
True, but don't pass bad dates in.
Well, it tooked me a hour to find the problem. Catching this should be easy as 1 2 3. Love that type of supportanswers. :D
Most helpful comment
Well, it tooked me a hour to find the problem. Catching this should be easy as 1 2 3. Love that type of supportanswers. :D