如何在Xcode中启用NSZombie?
本文翻译自:How to enable NSZombie in Xcode?
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? 有人知道如何在Xcode 4中启用NSZombie吗?
#1楼
参考:https://stackoom.com/question/MbBY/如何在Xcode中启用NSZombie
#2楼
in ur XCODE (4.3) next the play button :) (run) 在ur XCODE(4.3)中,旁边的播放按钮:)(运行)
select : edit scheme 选择:编辑方案
the scheme management window will open 方案管理窗口将打开
click on the Arguments tab 单击参数选项卡
you should see : 1- Arguments passed on launch 2- environment variables 您应该看到:1-启动时传递了参数2-环境变量
inside the the (2- environment variables) place Name: NSZombieEnabled (2-环境变量)内部的名称:NSZombieEnabled
Value: YES 值:是
And its done.... 完成了...
#3楼
It's a simple matter of setting an environment variable on your executable (NSZombieEnabled = YES)
, and then running/debugging your app as normal.If you message a zombie, your app will crash/break to debugger and NSLog
a message for you. 这是对你的可执行文件,设置环境变量的简单的事情(NSZombieEnabled = YES)
然后运行/调试您的应用程序作为normal.If你消息的僵尸,你的应用程序会崩溃/休息,以调试器和NSLog
为你的消息。
For more information, check out this CocoaDev page: http://www.cocoadev.com/index.pl?NSZombieEnabled 有关更多信息,请查看此CocoaDev页面: http : //www.cocoadev.com/index.pl? NSZombieEnabled
Also, this process will become much easier with the release of 10.6 and the next versions of Xcode and Instruments. 此外,随着10.6的发布以及Xcode和Instruments的下一版本,此过程将变得更加容易。 Just saying'. 只是说说而已。 =) =)
#4楼
在Xcode 4.5.2中,转到“产品”->“编辑方案”->,然后在“诊断”选项卡下选中“ Objective C”和“ Enable Zombie Objects”之间的复选框,然后单击“确定”。
#5楼
NSZombieEnabled is used for Debugging BAD_ACCESS, NSZombieEnabled用于调试BAD_ACCESS,
enable the NSZombiesEnabled environment variable from Xcode's schemes sheet. 从Xcode的方案表中启用NSZombiesEnabled环境变量。
Click on Product⇒Edit Scheme to open the sheet and set the Enable Zombie Objects check box
this video will help you to see what i'm trying to say. 该视频将帮助您了解我要说的话。
#6楼
Go to Product - Scheme - edit scheme - Arguments - Environment Variables set NSZombieEnabled = YES 转到产品-方案-编辑方案-参数-环境变量设置NSZombieEnabled = YES