Enable NSZombie in XCode 4

-

Cocoa Developers, especially new iOS and Mac developers have all likely run into the famous EXC_BAD_ACCESS error message in XCode. I'm not going to go into what that error message is and how it gets trigger. There's plenty of content on that online.

The way we normally debug those errors, are through NSZombies. You can go through Instruments and find those, but you can also just use the XCode Debugger while you're running the app in Debug by turning on the Environment Variable.

In XCode 3.x, you would simply right-click on the .app file in the Product category and choose Get Info then set the variable NSZombieEnabled to YES in the Arguments tab.

In XCode 4, this has been moved. The right-click menu no longer has the Get Info option, and there's also no Inspector to help you. Instead you must now go to, the top menu and select Product-> Edit Scheme or use the " ⌘ <" keyboard shortcut to bring up the menu.

Product Menu

From here, you can simply verify that the Run scheme is selected and set the environment variable in the tab as you normally have in XCode 3.

Scheme Menu