How do I set up NSZombieEnabled and CFZombieLevel for my executable in Xcode 4?
Join Stack Overflow to learn, share knowledge, and build your career.
|
|
|||||||||||||||||||||
|
|
In Xcode 4.x press ⌥⌘R(or click select the "Diagnostics" tab and click "Enable Zombie Objects":
This turns released objects into NSZombie instances that print console warnings when used again. This is a debugging aid that increases memory use (no object is really released) but improves error reporting. A typical case is when you over-release an object and you don't know which one:
This Xcode setting is ignored when you archive the application for App Store submission. You don't need to touch anything before releasing your application. Pressing ⌥⌘R is the same as selecting Product > Run while keeping the Alt key pressed. |
|||||||||||||||||||||
|
On In Xcode 7⌘<or select select As alternative, if you prefer |
|||
|
|
|
I find this alternative more convenient:
As soon as a zombie is detected you then get a neat "Zombie Stack" that shows you when the object in question was allocated and where it was retained or released:
Advantages compared to using the diagnostic tab of the Xcode Schemes:
|
||||
|
Cocoa offers a cool feature which greatly enhances your capabilities to debug such situations. It is an environment variable which is called NSZombieEnabled, watch this video that explains setting up NSZombieEnabled in objective-C |
|||
|
|
|
In Xcode > 4.3: You click on the scheme drop down bar -> edit scheme -> arguments tab and then add NSZombieEnabled in the Environment Variables column and YES in the value column. Good Luck !!! |
||||
|
|
|
In Xcode 4.2
|
||||
|
|
|
Jano's answer is the easiest way to find it.. another way would be if you click on the scheme drop down bar -> edit scheme -> arguments tab and then add NSZombieEnabled in the Environment Variables column and YES in the value column... |
|||
|
|


