Re: ARC and dealloc
Re: ARC and dealloc
- Subject: Re: ARC and dealloc
- From: Matt Neuburg <email@hidden>
- Date: Thu, 08 Dec 2011 12:21:22 -0800
On Thu, 08 Dec 2011 20:31:51 +0100, Mikkel Islay <email@hidden> said:
>A twist on the tale, is that the observer wasn't the UIViewController, but a helper object subclassed from NSObject. Hence view-unloading was one step further removed from deallocation of the observer-instance.
I have *never* added or removed any object other than self in the notification center. I would rather rearchitect some other aspect of my app to get messages passed around than break this rule.
Actually, I did it once and became hopelessly confused: my notification was never arriving and I didn't know why, and I couldn't easily find out because you can't query the notification center as to what observers it's got registered. Eventually it turned out that some other object was unregistering me behind my back. So since that day I have followed the above rule and have been a happy camper. I'm not saying it isn't possible, I'm not saying you shouldn't do it, I'm just saying. :) m.
--
matt neuburg, phd = email@hidden, <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook_______________________________________________
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