objective c - OS X 10.10.3 and notification center -


i developed app os x should send local notification. deployed app os x 10.9. app worked fine until apple update os x 10.10.3. installed app standard (not administrator) user , when go under system preference --> notification can't see app has permission send notification. here's code send loca notification on os x:

nsusernotification *notification = [[nsusernotification alloc]init]; notification.title = title; notification.informativetext = text; notification.soundname = nsusernotificationdefaultsoundname;  notification.userinfo = @{@"url": [nsstring stringwithformat:@"http://myurl.com/%@",detailparams]};                     nsusernotificationcenter *center = [nsusernotificationcenter defaultusernotificationcenter]; [center setdelegate:self]; [center schedulenotification:notification]; 

apple changed after installation of os x 10.10.3? if yes what's wrong code?

a couple things (which found @ tutorial here):

1)

instead of schedulenotification, try using:

[center delivernotification:notification]; 

2)

notification center displays notifications if application not frontmost. present notification, need set delegate on nsusernotificationcenter shown above, , implement nsusernotificationcenterdelegate follows:

- (bool)usernotificationcenter:(nsusernotificationcenter *)center shouldpresentnotification:(nsusernotification *)notification {     return yes; } 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -