Re: Dynamically subclassing an observed object
Re: Dynamically subclassing an observed object
- Subject: Re: Dynamically subclassing an observed object
- From: Ken Thomases <email@hidden>
- Date: Wed, 13 Oct 2010 15:54:36 -0500
On Oct 13, 2010, at 2:44 PM, Dave DeLong wrote:
> I maintain some code that does dynamic subclassing to override an object's -dealloc method to do some extra cleanup prior to deallocation. (And for the curious, this cleanup is not necessary when using Garbage Collection)
As mentioned, it's not safe to do isa-swizzling because KVO also does it.
Have you considered doing method swizzling on -[NSObject dealloc]? (And maybe -[NSProxy dealloc], too, I guess.)
Also, have you considered whether you really need to be doing these sorts of hacks at all? ;) For example, could you get away with objc_setAssociatedObject()?
Regards,
Ken
_______________________________________________
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