Re: ARC and dealloc
Re: ARC and dealloc
- Subject: Re: ARC and dealloc
- From: Mikkel Islay <email@hidden>
- Date: Thu, 08 Dec 2011 20:31:51 +0100
Thanks for the insightful reply, and of course to Jonny Yu and Scott Anguish as well.
On 8 Dec 2011, at 17:36, Matt Neuburg wrote:
>> You can certainly make assumptions about when dealloc is called - it is extremely deterministic, actually. See Greg Parker's discussion (in the WWDC 2011 videos) of the order in which things happen as an object goes out of existence.
Indeed I will.
..
>
>> PS In the case of a view controller on iOS, I usually register in viewDidAppear and unregister in viewWillDisappear. But you still have to use one of these solutions to make sure the observer isn't also retained by self, or you'll leak.
That was I ended up implementing as well.
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.
/Mikkel Islay
_______________________________________________
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