How do I set up NSZombieEnabled in Xcode 4?

前端 未结 7 1048
栀梦
栀梦 2020-11-21 13:03

How do I set up NSZombieEnabled and CFZombieLevel for my executable in Xcode 4?

相关标签:
7条回答
  • 2020-11-21 13:43

    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 !!!

    0 讨论(0)
  • 2020-11-21 13:44

    In Xcode 4.x press

    R

    (or click Menubar > Product > Scheme > Edit Scheme)

    select the "Diagnostics" tab and click "Enable Zombie Objects":

    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:

    • With zombies: -[UITableView release]: message sent to deallocated instance
    • Without zombies: EXC_BAD_ACCESS

    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.
    Clicking the "Enable Zombie Objects" checkbox is the same as manually adding "NSZombieEnabled = YES" in the section "Environment Variables" of the tab Arguments.

    0 讨论(0)
  • 2020-11-21 13:48

    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

    0 讨论(0)
  • 2020-11-21 13:49

    In Xcode 4.2

    • Project Name/Edit Scheme/Diagnostics/
    • Enable Zombie Objects check box
    • You're done
    0 讨论(0)
  • 2020-11-21 13:56

    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...

    0 讨论(0)
  • On In Xcode 7

    <

    or select Edit Scheme from Product > Scheme Menu

    select Enable Zombie Objects form the Diagnostics tab

    As alternative, if you prefer .xcconfig files you can read this article https://therealbnut.wordpress.com/2012/01/01/setting-xcode-4-0-environment-variables-from-a-script/

    0 讨论(0)
提交回复
热议问题