Re: NSDistributedNotificationCenter question
Re: NSDistributedNotificationCenter question
- Subject: Re: NSDistributedNotificationCenter question
- From: Julien Jalon <email@hidden>
- Date: Sun, 8 Jun 2003 19:09:47 +0200
On Sunday, Jun 8, 2003, at 17:15 Europe/Paris, Ronald Oussoren wrote:
Hi,
I'm one of the authors of PyObjC and one of our users complained that
NSDistributedNotificationCenter doesn't work. Luckily for me a
Objective-C version of his demo program gives exactly the same
behaviour. I could not find in the documentation *why* it behaves as
it does, hence this email.
The program below listens for nofications on the default distributed
nofication center. It then posts a notification from the same process.
The thing that confuses my is that the receiver of the program cannot
access the original 'object' of the nofication, it is always 'nil'.
Why is this?
Ronald
[...]
This not really a bug but a feature. As stated in
NSDistributedNotificationCenter:
"- (void)postNotificationName:(NSString *)notificationName
object:(NSString *)anObject
Creates a notification with the name notificationName, associates it
with the string anObject, and posts it to the notification center.
anObject may be nil."
As you can note... anObject HAS TO BE A STRING.
and that's understandable since not any object can be sent across
processes.
In distributed notification case, you have to use string identifying
the underlying real object.
--
Julien Jalon
http://www.julien-jalon.org/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.