如何添加NSDebug.h和使用NSZombie在iPhone SDK [英] How to add NSDebug.h and use NSZombie in iPhone SDK

查看:169
本文介绍了如何添加NSDebug.h和使用NSZombie在iPhone SDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要为我的iPhone应用程式启用NSZombies。

I want to enable NSZombies for my iPhone app.

我已在网上阅读过几篇文章,但仍不确定其具体程序。

I have read several articles online and I am still unsure of the exact procedure.

我知道我必须设置我所做的环境变量:

I know I have to set the Environment Variables, which I have done:

NSZombieEnabled = YES
NSDebugEnabled = YES
NSDeallocateZombies = NO

不确定),我必须导入NSDebug.h。
当我在我的项目中检查Foundation框架的标题时,没有NSDebug.h。

I think (I'm not sure), I have to import NSDebug.h. When I check the headers of the Foundation Framework in my project, there is no NSDebug.h.

经过一番研究,我发现他们在iPhoneSimulator基金会框架。
所以(我不知道这是否正确),我将iPhoneSimualtor基础框架导入我的项目。
我注意到文件STILL没有显示在项目窗口中,即使我可以在Finder中找到它(这是正常的行为吗?)。

After some research, I found them in the iPhoneSimulator Foundation Framework. So (and I'm not sure if this is correct), I imported the iPhoneSimualtor Foundation Framework into my project. I noticed that the file STILL does not show up in the project window, even though I can locate it in the Finder.(Is this normal behavior?).

因此我打开了main并添加了:

So I opened up main and added:

#ifdef TARGET_IPHONE_SIMULATOR
#import <Foundation/NSDebug.h>
#endif

我不知道这是否正确。之后,我仍然不能得到NSZombie工作(除非我误解了它应该做什么)
我希望看到NSZombie发送一个发布...的日志或某事。但我没有看到任何东西。

I am not sure if that is right either. After this I still can't get the NSZombie to work (unless I have misunderstood what it is supposed to do) I am expecting to see a log of " NSZombie sent a release... " or something. But I don't see anything

我相信我只是没有做到这一点,一个好的一步一步将不胜感激。
感谢

I'm sure I'm just not doing this right, a good step by step would be appreciated. Thanks

还要注意,我还启用了:

Also of note, I have also enabled:

NSMallocStacklLogging = YES
MallocStackLoggingNoCompact = YES


推荐答案

p>您不必包含NSDebug.h或导入任何特殊框架使用NSZombies。基本上,打开你的环境变量,然后,如果你尝试消息一个dealloc'd对象,那么你会看到一些东西在你的控制台,按照:

You don't have to include NSDebug.h or import any special frameworks to use NSZombies. Basically, turn 'em on in your environment variables, and then, if you attempt to message a dealloc'd object, THEN you'll see something in your console, along the lines of:

2009-02-10 21:17:08.546 MyApp [16926:20b] *** - [CFString _cfTypeID]:消息发送到deallocated实例0x4babc0

这篇关于如何添加NSDebug.h和使用NSZombie在iPhone SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆