How to intercept deallocate callbacks of Core Foundation objects in Objective-C.

Posted by Matteo on Stack Overflow See other posts from Stack Overflow or by Matteo
Published on 2010-06-18T04:42:06Z Indexed on 2010/06/18 4:53 UTC
Read the original article Hit count: 230

I'm writing an Eiffel wrapper for AppKit and Foundation and I need to hijack all -dealloc methods.

Thanks to the dynamic nature of Objective-C it is pretty easy to do that. But the problem is it only works with some of the Foundation or AppKit objects. There are certain objects (e.g. NSString, NSArray, NSDate, ...) that are actually CF objects so the dealloc method doesn't get called. Instead the deallocate callbacks of the allocator that allocated the CF object is called. Is there a way to intercept that?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about core-foundation