Telerik-Verified-Plugins / LocalNotification

Apache License 2.0
21 stars 27 forks source link

On iOS 9 the plugin freezes app #11

Closed ghost closed 8 years ago

ghost commented 8 years ago

I upgraded my iPhones and Xcode over the weekend to iOS 9 and now my app freezes as soon as notification is scheduled like:

cordova.plugins.notification.local.schedule({
                id        : Math.floor(Math.random() * 1000),
                title     : 'Parking Meter',
                text      : 'Your parking meter time expires soon!',
                every     : 'minute',
                //autoClear : true,
                at        : new Date(new Date().getTime() + duration*60*1000)
            });

Xcode jumps to APPLocationNotificationOptions.m line 142 EXC_BAD_ACCESS ...

Anyone else with the same issue?

Same code still working as expected on Samsung 6 Edge with Android 5.0.2.

EddyVerbruggen commented 8 years ago

Taking a look, thanks!

EddyVerbruggen commented 8 years ago

Hi @bardu, thanks again for letting us know. 0.8.2dev3 fixes the issue.

ghost commented 8 years ago

Thanks for the quick fix!

marcvanh commented 8 years ago

Thanks for the fix, however now the app is freezing in a different spot:

Xcode jumps to UIApplication+APPLocalNotification.m, line 1919, SIGABRT

EddyVerbruggen commented 8 years ago

@bardu do you have the same problem? @marcvanh that's a strange line number, since the class is only 331 lines long..

marcvanh commented 8 years ago

Sorry - it's line 191

    if ([notification.options.id isEqualToNumber:id]) {
EddyVerbruggen commented 8 years ago

Thanks @marcvanh, did you set an ID like in @bardu's example?

marcvanh commented 8 years ago

In case it helps, it is happening on a cancel() call, and the id passed may not exist. I haven't tested other calls.

marcvanh commented 8 years ago

There would have been an id, but it may have never been a valid notification. It's a catch-all cancel that always worked prior to iOS 9

EddyVerbruggen commented 8 years ago

Thanks for clearing that up - ideas for a fix as well perhaps?

marcvanh commented 8 years ago

No, sorry I am not too familiar with Obj C

EddyVerbruggen commented 8 years ago

If you can, please try this instead of the current line 191 - guessing the id is nil..:

        if (notification.options.id != nil && [notification.options.id isEqualToNumber:id]) {
marcvanh commented 8 years ago

Just tested - the value was actually not nil - it was a real notification id.

EddyVerbruggen commented 8 years ago

I don't think I can help you since I can't reproduce it..

marcvanh commented 8 years ago

Have you tried it with a non-existent notification id?

EddyVerbruggen commented 8 years ago

Is there a way to create one that you know of?