Search code examples
objective-cioscocoanszombie

Cocoa Zombies - Identifying source of message


I have turned on "Enable Zombie Objects", and I am getting the following:

2012-08-06 13:43:05.452 MyApp[234:707] *** -[MyViewController respondsToSelector:]: message sent to deallocated instance 0x97a6c50

I would like to know: is there an easy way to find out which object is sending the message to MyViewController? MyViewController is a delegate for a number of different things, and I would like to figure out which thing is sending the message.


Solution

  • You can request a stack trace in the debugger to see which functions called which other functions. For example, with GDB, you can see something like:

    (gdb) bt
    0x01234567 in main()
    0xabcdef12 in UIApplicationMain
    0xdef01234 in - [AppDelegate application:didFinishLaunchingWithOptions:]
    

    etc.