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
2010-08-13 11:33:03
I am not getting EXE_BAD_ACCESS type of error. It's just that it's silently ignored. Does NSZomebieEnabled still help?
huggie
2010-08-15 13:19:06