How can I create a new, custom NSUserNotificationCenter
instance? I don't mean [NSUserNotificationCenter defaultUserNotificationCenter]
, I mean something like [NSUserNotificationCenter new]
(which doesn't work, for me).
Asked
Active
Viewed 248 times
0

user732274
- 1,069
- 1
- 12
- 28
-
2Why do you want to do that? – Wain Jun 22 '13 at 16:16
-
1. is there any reason why you want your own `NSUserNotificationCenter`? Why doesn't the default one work for you? 2. *doesn't work* is not very indicative. What do you mean? – Gabriele Petronella Jun 22 '13 at 16:23
-
When I say that [NSUserNotificationCenter new] doesn't work I mean that making it deliver notifications doesn't show any notification on the screen. The default one DOES work for me, but for some reason (which is not relevant) I'd like to know how to create another center. – user732274 Jun 22 '13 at 16:29
-
You can't and there's probably nothing that can be done about that. Why do you want to do this? Maybe we can help with the real problem. – Sven Jun 22 '13 at 16:41
-
I don't have a real problem, I'm just making experiments :) – user732274 Jun 22 '13 at 16:43
1 Answers
2
you cannot do this BECAUSE the class that is the real NotificationCenter is NOT the class NSUserNotificationCenter
. :)
The user notification center that does the real work is the private class _NSConcreteUserNotificationCenter
which is what you get back by default.
[NSUserNotificationCenter defaultUserNotificationCenter]
=> gets t_NSConcreteUserNotificationCenter
the [NSUserNotificationCenter defaultUserNotificationCenter]
is a factory method and not just a short way to do alloc/init

Daij-Djan
- 49,552
- 17
- 113
- 135