Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crashes: reason: '-[NSNull doubleValue]: unrecognized selector #1331

Closed
hirbod opened this issue Jun 20, 2017 · 3 comments
Closed

App crashes: reason: '-[NSNull doubleValue]: unrecognized selector #1331

hirbod opened this issue Jun 20, 2017 · 3 comments

Comments

@hirbod
Copy link

hirbod commented Jun 20, 2017

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

@hirbod
Copy link
Author

hirbod commented Jun 20, 2017

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()
            });
        }

@rwillett
Copy link
Collaborator

True, but don't pass bad dates in.

@hirbod
Copy link
Author

hirbod commented Jun 20, 2017

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

@hirbod hirbod closed this as completed Jun 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants