ios - Local notification app crashes simulator -
ios - Local notification app crashes simulator -
i'm using local notification plugin (https://github.com/katzer/cordova-plugin-local-notifications/) ng-cordova ionic poject:
this controller:
.controller('dashctrl', function($scope, $state, $cordovalocalnotification) { $scope.addnotification = function() { $cordovalocalnotification.add({ id: 'some_notification_id' // parameter documentation: // https://github.com/katzer/cordova-plugin-local-notifications#further-informations-1 }).then(function() { console.log('callback adding background notification'); }); }; $scope.checkifistriggered = function() { $cordovalocalnotification.istriggered('some_notification_id').then( function(istriggered) { alert('istriggered'); }); }; })
i have button on default view loaded when app starts ng-click, so:
<button ng-click="addnotification();" class="button button-stable">button-stable</button>
but when run app in emulator , tap button, app crashes followiing error message:
: *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '- [__nscfstring stringvalue]: unrecognized selector sent instance 0x7a840850' *** first throw phone call stack: ( 0 corefoundation 0x002cc1e4 __exceptionpreprocess + 180 1 libobjc.a.dylib 0x023848e5 objc_exception_throw + 44 2 corefoundation 0x00369243 -[nsobject(nsobject) doesnotrecognizeselector:] + 275 3 corefoundation 0x002bc50b forwarding + 1019 4 corefoundation 0x002bc0ee cfforwarding_prep_0 + 14 5 new 0x0011f917 -[applocalnotification notificationwithid:] + 503 6 new 0x0011f6a6 -[applocalnotification isnotificationscheduledwithid:] + 86 7 new 0x0011bccf __28-[applocalnotification add:]blockinvoke + 207 8 libdispatch.dylib 0x0293d7b8 dispatchcall_block_and_release + 15 9 libdispatch.dylib 0x029524d0 dispatchclient_callout + 14 10 libdispatch.dylib 0x02940eb7 dispatchroot_queue_drain + 291 11 libdispatch.dylib 0x02941127 dispatchworker_thread2 + 39 12 libsystem_pthread.dylib 0x02c89dab pthreadwqthread + 336 13 libsystem_pthread.dylib 0x02c8dcce start_wqthread + 30 ) oct 19 11:54:21 xxxx-macbook-air.local backboardd[27466] : application 'uikitapplication:com.ionicframework.new903016[0xde04]' exited abnormally signal 6: abort trap: 6"
has got work next ng-cordova docs, or there approach should trying.
thank's!
if you're still having issue, ran today well.
go plugin code, applocalnotifications.m in xcode , alter line, towards bottom:
nsstring* notid = [[notification.userinfo objectforkey:@"id"] stringvalue];
and replace this:
nsstring* notid = [notification.userinfo objectforkey:@"id"];
this worked me today.
ios cordova plugins ionic-framework
Comments
Post a Comment