Calendar-PhoneGap-Plugin
Calendar-PhoneGap-Plugin copied to clipboard
iOS 13 App crashes when using findEvent()
Hey,
I'm using this plugin in Ionic 3 project, cordova 9.0.0, cordova-ios 5.0.1, iPhone SE, iOS 13.1.3. And when I'm trying to get events for some date interval like this:
let startDate = new Date('2019-10-20');
let endDate = new Date('2019-10-24');
let result = await this.calendar.findEvent(
null,
null,
null,
new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate(), 0, 0, 0),
new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate(), 23, 59, 59),
);
console.log(result);
My app crashes and I get error in XCode like this:
2019-10-24 12:16:14.019675+0300 Minn[964:278961] -[NSNull stringValue]: unrecognized selector sent to instance 0x1f51cf9a0
2019-10-24 12:16:14.020647+0300 Minn[964:278961] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull stringValue]: unrecognized selector sent to instance 0x1f51cf9a0'
*** First throw call stack:
(0x1b907c98c 0x1b8da50a4 0x1b8f8043c 0x1b9080e08 0x1b9082bec 0x104504464 0x1044fbb54 0x104b79828 0x104b7ac04 0x104b7d300 0x104b8c168 0x104b8ca90 0x1b8d99f64 0x1b8d9cae0)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Before iOS 13 it worked well but after upgrading plugin constantly crashes. Any idea why?
Thanks! Andrew.
UPDATE: empty string ('') instead of null passed into the function fixed the problem! So it's good to typecast passed values and close the issue. Thanks!
Same issue experienced here. Trying to fix it using "" empty string.
@AndrewBargan or @dapuzz are you still having issues with this? I was about to upgrade the version of this plugin in our Ionic application (currently on 4.12.0) but will hold back if there are iOS 13 issues?
@richardshergold In my environment (Ionic 3, cordova 9.0.0, cordova-ios 5.0.1, iPhone SE, iOS 13.1.3) no other issues so far
@AndrewBargan , @richardshergold
This doesn't work in Ionic 5.
this.calendar.findEvent(this.data.title, '', '', startDate, endDate)
I get this error message and app is crashed.
[NSNull doubleValue]: unrecognized selector sent to instance 0x1085c1ff0
Oh, it happened by invalid dates. It works well. Thanks