Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable NSZombie in Xcode?

Tags:

xcode

nszombie

I have an app that is crashing with no error tracing. I can see part of what is going on if I debug, but can't figure out which object is "zombie-ing".

Does anybody know how to enable NSZombie in Xcode 4?

like image 999
jason Avatar asked Mar 22 '11 02:03

jason


People also ask

How do I enable NSZombie?

In the "Product" menu, select "Edit Scheme". Go to the "Run Foo. app" stage in the left panel, and the "Arguments" tab on the right. Add NSZombieEnabled to the "Environment Variables" section and set the value to YES , as you could in Xcode 3.

How do I disable NSZombieEnabled?

Go to Project -> Edit Active Executable Click Arguments Click + in the "Variables to be set in the environment" section Enter NSZombieEnabled in the Name column and YES in the Value column. Make sure the checkmark for the NSZombieEnabled entry is checked.

What is NSZombie?

It's a memory debugging aid. Specifically, when you set NSZombieEnabled then whenever an object reaches retain count 0, rather than being deallocated it morphs itself into an NSZombie instance. Whenever such a zombie receives a message, it logs a warning rather than crashing or behaving in an unpredictable way.


1 Answers

Environment variables are now part of the "scheme".

To edit the scheme and turn on zombies:

  • In the "Product" menu, select "Edit Scheme".

  • Go to the "Run Foo.app" stage in the left panel, and the "Arguments" tab on the right.

  • Add NSZombieEnabled to the "Environment Variables" section and set the value to YES, as you could in Xcode 3.


In Xcode 4.1 and above, there's also a checkbox on the "Diagnostics" tab of the "Run" stage to "Enable Zombie Objects".


With Xcode 6.4:

Screenshot

like image 149
一二三 Avatar answered Sep 28 '22 12:09

一二三