Re: Crashing Problem calling postNotificationName
Re: Crashing Problem calling postNotificationName
- Subject: Re: Crashing Problem calling postNotificationName
- From: Graham Cox <email@hidden>
- Date: Wed, 11 Sep 2013 15:22:38 +0200
On 11/09/2013, at 3:13 PM, Dave <email@hidden> wrote:
> Yes, but it doesn't remember the last value of a notification, which is what I would like.
[]
> Yes, I am removing myself as a receiver, but ideally I want to receive these notification even if the object is dead. By this I mean, I want the last known value of the notification restored when the Object in question starts up again. At present I have to save this somewhere ugly and restore it from somewhere ugly. I just thought it would be nice to be able to just make a call something like:
>
> -(void) reissueLastNotificationName:@"Note1" forClass:self
>
> Rather than save it somewhere ugly 26 more times!
>
> I could maybe subclass NSNotificationCenter?
There are a couple of statements here that don't make a huge amount of sense. What do you mean by "an object….starts up again"?
Perhaps the problem is really that your object should not be being killed until the final notification has been received? That's a different problem. If you mean you want to save something between launches of your app so you can restore state, that's easily done by the sender of the notification.
Basically, there isn't enough detail in your question to advise, and what you have given appears to smell a bit. "Reissuing" a notification sounds like a band-aid for a problem that should be solved some other way, to me. Subclassing NSNotificationCenter is presumably possible, but sounds like the wrong way to do whatever it is you are really trying to do.
--Graham
_______________________________________________
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