Call a macro every time any method is called - Objective C

Posted by Jacob Relkin on Stack Overflow See other posts from Stack Overflow or by Jacob Relkin
Published on 2010-05-06T17:47:35Z Indexed on 2010/05/06 19:48 UTC
Read the original article Hit count: 307

Filed under:
|

Hi,

I wrote a debug macro that prints to the console the passed-in string whenever the global kDebug flag == YES.

I need to print out the name of a method and it's classname whenever any method is called.

That works fine when i painstakingly go through every method and write the name of the class and the method in a string.

Is there any special handler that gets called when any method in Objective-C is called, and if so, is there a way i can somehow override it to call my debug macro??

The entire purpose of this is so that I don't have to go through every method in my code and hand-code the method signature in the debug macro call.

Thanks

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about methods