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 protected]> 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 protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
