Local notification crashes the iOS app

When i schedule the notification it crashes the app in iOS. is shows error in

APPLocalNotification.m

- (id) initWithOptions:(NSDictionary*)dict {
   self = [super init];
   [self setUserInfo:dict];                        Thread 18:signal SIGABRT
   [self __init];
   return self;
}

Please try to find out the good solution for me.

Thanks you.

the same!
i update my plugin but is the same

can you please provide the code

    document.addEventListener('deviceready', function () {
      $cordovaLocalNotification.schedule({
        id: objId,
        title: titolo,
        text: testo,
        at: data
      }).then(function () {
          //console.log('Notifica Aggiunta');
        });
    }, false);

what version of $cordovaLocalNotification
do you have…

try reinstall the plugin

and what is the id of the objId
and what the date you pass to at

thx

Thanks for the response @ItamarCohen

I’m using @0.8.4 latest version of local Notification.

and i reinstalled the plugin more then 10 time. :weary:

Code i’m using to Schedule local notification.

$cordovaLocalNotification.schedule({
  id    : remId,
  title : name.innerHTML,
  text  : note.value,
  every : 'year',
  at    : _2_year_from_now
});

hi,

can you give me an example
with the data ;

id: int
title:'what type of string’
text:'dummy text’
every: ‘year’,
at: HOW YOU calc the time

ie:

$scope.scheduleDelayedNotification = function () {
  var now = new Date().getTime();
  var _10SecondsFromNow = new Date(now + 10 * 1000);

  $cordovaLocalNotification.schedule({
    id: 1,
    title: 'Title here',
    text: 'Text here',
    at: _10SecondsFromNow
  }).then(function (result) {
    // ...
  });
};

I’m calculate like

var now             = new Date(alertDate),
 _3_months_from_now  = new Date(now + 3*30*24*60*60*1000),
_6_months_from_now  = new Date(now + 2*_3_months_from_now),
_2_year_from_now    = new Date(now + 4*_6_months_from_now),
_5_year_from_now    = new Date(now + 10*_6_months_from_now),
_5_sec_from_now     = new Date(now + 5*1000);  

But i got issue when run app in emulator

[self setUserInfo:dict]; Thread 18:signal SIGABRT

Please try to find out good solution for me…

do you test the app on iOS 9

Yes i checked in iOS 9.1 and 9.2 :frowning:

hi try

cordova plugin remove de.appplant.cordova.plugin.local-notification
cordova plugin add https://github.com/willyboy/cordova-plugin-local-notifications.git
ionic build ios

I already tried i faced same problem… once again i will check and let you know…

Please refer the below screenshot which i was faced when app run…

image

what is the alertDate // can you give me the value like you pass it

@ItamarCohen

When i use the plugin…cordova plugin add https://github.com/willyboy/cordova-plugin-local-notifications.git

I got issue like…

error: linker command failed with exit code 1 (use -v to see invocation)

alertDate - 25-01-2016 convert alertDate into Date object.

return to the katzer plugin
and i think your problem is with date manipulation

please try this like in the example

and tell me what is the error

var now = new Date().getTime();
var _10SecondsFromNow = new Date(now + 10 * 1000);

Hi @ItamarCohen

Are you sure is that problem in date object?

Same functionality works fine android device. so only i asked… :fearful:

i checked it
in iOS device and android

new Date('25-01-2016'); --> is Invalid Date

use 2016-01-25 and set the time for now
and check you’re timezone if it correct .

Hi @ItamarCohen ,

Please refer the code how i was calculate the alertDate.

Sample date dateD = 01-25-2016

    var Sdate      = new Date(dateD);
    var Rimyear    = Sdate.getFullYear();
    var Rimmonth   = Sdate.getMonth();
    var Rimdate    = Sdate.getDate();            

    var storedDate = timeD;
    var x = storedDate.substr(0,2); // x will have hours
    var y = storedDate.substr(3,2); // y will have minutes
    var z = storedDate.substr(6,2); // z will have meridian
    if(z == 'PM'){
      var xH = parseInt(x) + 12; 
    }else{
      var xH = x;
    }

    //Convert the hours and minutes to number
    var inputDate = new Date();
    inputDate.setHours(xH);
    inputDate.setMinutes(y);

    var Rimhours   = inputDate.getHours();
    var Rimminutes = inputDate.getMinutes();      

    if(BeforeT != null){
      if(BeforeO == 'min'){
        var Bminute     = BeforeT;
        var delayDate   = new Date(Rimyear,Rimmonth,Rimdate,Rimhours,Rimminutes,0).getTime();
        var alertDate   = new Date(delayDate - Bminute * 60 * 1000);                
      }else{
        var Bminute     = BeforeT;
        var delayDate   = new Date(Rimyear,Rimmonth,Rimdate,Rimhours,Rimminutes,0).getTime();
        var alertDate   = new Date(delayDate - Bminute * 60 * 60 * 1000);
      }
    }else{
      var alertDate   = new Date(Rimyear,Rimmonth,Rimdate,Rimhours,Rimminutes,0);
    }

hi,

please provide more data:

timeD = ??
BeforeT = ??

@ItamarCohen

dateD = “01-27-2016” (MM-DD-YYYY)

timeD = “12.00 AM”

BeforeT = “5”

BeforeO = “min”