NSUserNotificationAlertStyle plist key not working
Asked Answered
G

4

8

I am working on sample user notification on 10.8 however the key NSUserNotificationAlertStyle when i set it to alerts not working, my application still shows it as banner, the only way to control it through the system preference but what if i want to set the default behaviour to be alert style??

Gonfanon answered 16/4, 2013 at 5:57 Comment(0)
I
9

According to these two bug reports, the key NSUserNotificationAlertStyle isn't working for anyone at the moment.

http://openradar.appspot.com/12632111

http://openradar.appspot.com/12632157

Ineradicable answered 23/5, 2013 at 11:17 Comment(0)
R
13

It works, but you must

  1. Code sign your application;
  2. Set alert string value for NSUserNotificationAlertStyle key in your app info.plist file;
  3. Make sure they are not turned off in Notifications tab of System Preferences.

If you already experiment with notifications it will be better to perform it from scratch. Here how you can remove app from User Notification Center.

Rizas answered 12/9, 2014 at 13:54 Comment(2)
I can confirm this. I compiled my app, transferred it to another machine, it was still banner type. Signed it and transferred it again, everything works flawlessly now.Bullins
how exactly do I need to sign the app? I've signed it with Developer ID certificate and it still doesn't set it to alert type automatically when I allow notifications in system banner. I also set NSUserNotificationAlertStyle to alert in plist and tried other fresh computers and deleting app from notifications settings on mine. nothing. either it is signing has no effect or something else :(Berny
I
9

According to these two bug reports, the key NSUserNotificationAlertStyle isn't working for anyone at the moment.

http://openradar.appspot.com/12632111

http://openradar.appspot.com/12632157

Ineradicable answered 23/5, 2013 at 11:17 Comment(0)
W
0

After go through every topics about this issue, I think there might be not very clear in each part, so I try to list all the steps for the developer who might also have this problem. To have the alert notification work, you can follow with Lexandr's sign steps 1,2,3, then you will get it work.

But if you are in the developing phase, or just have a debug, you still want to see what it looks like in the notification center. You need to open system preference->notifications, find your debug app, and choose the alert style to alerts. Then you can continue to develop without waiting for the sign to see the final result.

Wateriness answered 24/3, 2019 at 4:43 Comment(1)
Another tips, please remove the old setting in preference->notifications, when you want to change your notification style.Wateriness
B
-1

You don't need to sign your code, but the end user can change your notification type from System Preferences --> notifications (and then he can choose, None/Banner or Alert). See also this post: Add Alert vs Notification flag

Bracteate answered 10/1, 2018 at 16:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.