tags:

views:

15

answers:

1

Is it possible to make messages sent to nil generate some sort of error in run time? I want it for the debugging purpose.

+1  A: 

You may want to look into the NSZombieEnabled environment variable.

As @jtbandes said, nil messages are generally a good thing because you can avoid going if (object) [object message] and instead just use [object message]. But a far more important thing to watch out for is sending a message to an object that once existed but has now been freed (without the pointer being nil-ed out). NSZombieEnabled lets you find out when this has happened.

David
I am not getting EXE_BAD_ACCESS type of error. It's just that it's silently ignored. Does NSZomebieEnabled still help?
huggie