How to add NSDebug.h and use NSZombie in iPhone SDK

Are you setting the environment variable correctly? The step by step guide is

  1. Double-click an executable in the Executables group of your Xcode project.
  2. Click the Arguments tab.
  3. In the "Variables to be set in the environment:" section, make a variable called "NSZombieEnabled" and set its value to "YES".

You don't need to #import NSDebug.h


You don't have to include NSDebug.h or import any special frameworks to use NSZombies. Basically, turn 'em on in your environment variables, and then, if you attempt to message a dealloc'd object, THEN you'll see something in your console, along the lines of:

2009-02-10 21:17:08.546 MyApp[16926:20b] *** -[CFString _cfTypeID]: message sent to deallocated instance 0x4babc0


-1 to Apple. Debug builds should be running with full instrumentation out of the box (with a choice to opt-out). Also see http://www.cocoadev.com/index.pl?NSZombieEnabled for additional itms of interest to someone who is developing and debugging a program.