Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to log the class and object that is sending a message to another method?

I am trying to find out which one of my objects is sending a release message and how many times. I need a way to print out in the debugger the object that is sending the message. Is this possible to do?

like image 957
Stephen Avatar asked Jan 18 '26 11:01

Stephen


1 Answers

You can always use:

NSLog( @"[%@ %@] - %d -> Doing something", [self class], NSStringFromSelector(_cmd), __LINE__ );

But, if you trying to figure out if an object is being deallocated before you expected, a better method would be enable NSZombie. This SO answer has very good instructions on how to enable NSZombie, and this should help to use NSZombie with Instruments.

like image 178
Mike D Avatar answered Jan 21 '26 07:01

Mike D