如何在 Xcode 4 中设置 NSZombieEnabled? [英] How do I set up NSZombieEnabled in Xcode 4?
问题描述
如何在 Xcode 4 中为我的可执行文件设置 NSZombieEnabled
和 CFZombieLevel
?
How do I set up NSZombieEnabled
and CFZombieLevel
for my executable in Xcode 4?
推荐答案
在 Xcode 4.x 中按
In Xcode 4.x press
(或点击Menubar
> Product
> Scheme
> Edit Scheme
)
(or click Menubar
> Product
> Scheme
> Edit Scheme
)
选择诊断"选项卡并单击启用僵尸对象":
select the "Diagnostics" tab and click "Enable Zombie Objects":
这会将释放的对象变成 NSZombie 实例,再次使用时会打印控制台警告.这是一个调试辅助工具,它增加了内存使用(没有真正释放对象)但改进了错误报告.
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:
- 有僵尸:
-[UITableView release]:消息发送到释放实例
- 没有僵尸:
当您为 App Store 提交归档应用程序时,此 Xcode 设置将被忽略.在发布您的应用程序之前,您不需要接触任何东西.
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.
按 ⌥⌘R 与选择产品 > 运行相同,同时按住 Alt 键.
单击启用僵尸对象"复选框与在选项卡参数的环境变量"部分手动添加NSZombieEnabled = YES"相同.
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.
这篇关于如何在 Xcode 4 中设置 NSZombieEnabled?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!