Closed carmelodiventi closed 9 years ago
Similar problem here..
Stacktrace: * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFBoolean isEqualToString:]: unrecognized selector sent to instance 0x1043cc420' * First throw call stack: ( 0 CoreFoundation 0x0000000104122f35 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x0000000107229bb7 objc_exception_throw + 45 2 CoreFoundation 0x000000010412a04d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 3 CoreFoundation 0x000000010408227c __forwarding + 988 4 CoreFoundation 0x0000000104081e18 _CF_forwarding_prep_0 + 120 5 Sense 0x0000000103dc17fa -[APPLocalNotificationOptions stringIsNullOrEmpty:] + 154 6 Sense 0x0000000103dc1123 -[APPLocalNotificationOptions soundName] + 99 7 Sense 0x0000000103dc44ba -[UILocalNotification(APPLocalNotification) init] + 410 8 Sense 0x0000000103dc42ca -[UILocalNotification(APPLocalNotification) initWithOptions:] + 154 9 Sense 0x0000000103dbc604 33-[APPLocalNotification schedule:]_block_invoke + 388 10 libdispatch.dylib 0x000000010794aba6 _dispatch_call_block_and_release + 12 11 libdispatch.dylib 0x00000001079687f4 _dispatch_client_callout + 8 12 libdispatch.dylib 0x000000010795315d _dispatch_root_queue_drain + 1097 13 libdispatch.dylib 0x00000001079545d9 _dispatch_worker_thread3 + 111 14 libsystem_pthread.dylib 0x0000000107cec6cb _pthread_wqthread + 729 15 libsystem_pthread.dylib 0x0000000107cea4a1 start_wqthread + 13 ) libc++abi.dylib: terminating with uncaught exception of type NSException
Adding a notification though safari debug works like a charm!
I was having a similar problem which was traced back to the following in UIApplication+APPLocalNotification.m (around line 200):
/**
* Get local notification with ID.
* @param id
* Notification ID
*/
- (UILocalNotification*) localNotificationWithId:(NSString*)id
{
NSArray* notifications = self.localNotifications;
for (UILocalNotification* notification in notifications)
{
// this is causing a crash because of the notification.options.id being 'seen' as a number compared with a string. isEqualToString throws an exception.
// Apologies: my naive kludge fix is to wrap notification.options.id in [NSString stringWithFormat:@"%@", notification.options.id] to convert it into something compatible with isEqualToString; BUT not sure if this actually, properly does the comparison wanted
// if ([notification.options.id isEqualToString:id]) {
if ([[NSString stringWithFormat:@"%@", notification.options.id] isEqualToString:id]) {
return notification;
}
}
return NULL;
}
I have commented the code above explaining my kludge fix. Hope this helps anyone out. Please critique and feedback with any advice as to how to properly fix. TIA.
Apparently, local notifications only work if your app is in background. You should try delaying your notification for X seconds then press the home button to exit the app. Then you'll get the notification. That works for me.
Sounds like the option object is missing when you try to add the notification.. I realized that my problem was due to a mismatch in variable name (and that rerunning the app in xcode doesn't rebuild the app so most of my debugging was worthless On 19 Feb 2015 22:02, "clawish" notifications@github.com wrote:
Does not works for me. Compiling is not possible and yields the error
property 'options' not found on object of type 'UILocalNotification *'
with your solution. :/
— Reply to this email directly or view it on GitHub https://github.com/katzer/cordova-plugin-local-notifications/issues/413#issuecomment-75125018 .
For me the notifications still work even if the app is in foreground On 20 Feb 2015 03:56, "Eduardo Ayala" notifications@github.com wrote:
Apparently, local notifications only work if your app is in background. You should try delaying your notification for X seconds then press the home button to exit the app. Then you'll get the notification. That works for me.
— Reply to this email directly or view it on GitHub https://github.com/katzer/cordova-plugin-local-notifications/issues/413#issuecomment-75177169 .
@MaZZly,
your exception comes from a wrong data type you assign to sound:
That property requires a string path and not a boolean value.
Something like
sound: "file://sound.mp3"
and not
sound: true|false
@iwakari, yours the same with id
. When assigning a value from wrong data type you might end up with an exception sooner or later.
I was having a similar problem. What solved my issue was setting id to a Number or a strictly numeric string. When my id had letters in it, it crashed. Hope that helps someone.
The documentation does say it can be NaN, but it's either broken or perhaps the documentation should change the id type to Number.
Note: The notification ID must be a string which can be converted to a number (that is, isNaN() returns false for). If the ID has an invalid format, it will silently be changed to 0 and will override an earlier one with the same ID.
I've been trying to get Local Notifications to work within an Ionic app, but when arrive the notification app exit with this error:
Application Specific Information: *\ Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CDVDevice didReceiveLocalNotification:]: unrecognized selector sent to instance 0x7ca69520' terminating with uncaught exception of type NSException abort() called CoreSimulator 110.4 - Device: iPhone 6 - Runtime: iOS 8.1 (12B411) - DeviceType: iPhone 6
I state that I have tried various solutions proposed on this page "https://github.com/katzer/cordova-plugin-local-notifications/issues/309" , and checking the files I have the latest version that includes the so-called changes , can anyone help me?
thanks in advance
This my function:
This my $scope: