Re: Asynchronous Notification Does NOT Work
Re: Asynchronous Notification Does NOT Work
- Subject: Re: Asynchronous Notification Does NOT Work
- From: Bing Li <email@hidden>
- Date: Mon, 06 Jun 2011 02:59:12 +0800
Dear Jens,
I just checked carefully. The instance of NSNotificationQueue keeps alive
when posting.
One issue is that the notification job is done in a thread I created
explicitly. It is the potential reason? I will test it.
Thanks,
Bing
On Mon, Jun 6, 2011 at 1:13 AM, Jens Alfke <email@hidden> wrote:
>
> 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
>
>
_______________________________________________
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