Cordova-plugin-local-notifications: App crashes: reason: '-[NSNull doubleValue]: unrecognized selector

Created on 20 Jun 2017  路  3Comments  路  Source: katzer/cordova-plugin-local-notifications

WARNING: IF YOU IGNORE THIS TEMPLATE, WE'LL IGNORE YOUR ISSUE. YOU MUST FILL THIS IN!

Provide a general summary of the issue.

Your Environment

  • Plugin version: 0.8.5
  • Platform: iOS
  • OS version: 10.3.2
  • Device manufacturer / model: iPhone 7
  • Cordova version (cordova -v): 7.0.1
  • Cordova platform version (cordova platform ls): 4.4.0
  • Plugin config
  • Ionic Version (if using Ionic)

Expected Behavior

_App should not crash_

Actual Behavior

_App crashes_

Steps to Reproduce

_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

Context

_Send a Local Notification when giving timer was reached_

Debug logs

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

bildschirmfoto 2017-06-20 um 15 17 02

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

All 3 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AbayIbrayev picture AbayIbrayev  路  4Comments

Kasendwa picture Kasendwa  路  3Comments

mino922 picture mino922  路  3Comments

Shashank2406 picture Shashank2406  路  5Comments

ibnbd picture ibnbd  路  4Comments