Re: Asynchronous Notification Does NOT Work
Re: Asynchronous Notification Does NOT Work
- Subject: Re: Asynchronous Notification Does NOT Work
- From: Jens Alfke <email@hidden>
- Date: Sun, 05 Jun 2011 10:13:42 -0700
On Jun 5, 2011, at 9:20 AM, Bing Li wrote:
> // This line does not work.
> // [[[NSNotificationQueue alloc]
> initWithNotificationCenter:[NSNotificationCenter defaultCenter]]
> enqueueNotification:[NSNotification
> notificationWithName:@"CONNECTION_DISCONNECTED"
> object:self userInfo:connectionDisconnectedDictionary]
> postingStyle:NSPostWhenIdle];
Weird; that should work. It’s been a few years since I used delayed notifications like this, but they worked fine for me in a Cocoa app.
The only thing I can imagine is that maybe in your real code the NSNotificationQueue instance is getting dealloced before it can post its notifications. Are you sure you’re managing its refcount so it stays alive?
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden