Stephen
Stephen

Reputation: 499

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?

Upvotes: 3

Views: 61

Answers (1)

Mike D
Mike D

Reputation: 4946

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.

Upvotes: 4

Related Questions