xcode 如何使用僵尸工具运行 iPhone 程序?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1417782/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 18:50:09  来源:igfitidea点击:

How to run iPhone program with Zombies instrument?

iphoneobjective-cxcodeinstruments

提问by Justin Kredible

I'm running XCode 3.2 on Snow Leopard and I'm trying to run the Zombies instrument against my app but the selection is grayed out and I don't know why. I know about the NSZombieEnabled environment variable. I have that set to YES on my application. I'm not sure if this matters, but, the app is an app that I started developing on Leopard with the previous version of XCode. Here is a screenshot of what my menu looks like:

我在 Snow Leopard 上运行 XCode 3.2 并且我试图在我的应用程序上运行 Zombies 工具,但选择是灰色的,我不知道为什么。我知道 NSZombieEnabled 环境变量。我在我的应用程序中将其设置为 YES。我不确定这是否重要,但是,该应用程序是我开始在 Leopard 上使用先前版本的 XCode 开发的应用程序。这是我的菜单外观的屏幕截图:

ScreenShot

截屏

采纳答案by Florin

You need to launch the Instruments application with the Zombies instrument from outside of XCode

您需要从 XCode 外部使用 Zombies 工具启动 Instruments 应用程序

This is how you can do it:

你可以这样做:

The Instruments application is usually located inside /Developer/Applications/, but you can also use Spotlight to find it.

Instruments 应用程序通常位于 里面/Developer/Applications/,但您也可以使用 Spotlight 找到它。

When Instruments starts you should be presented with a screen that asks you to choose a template for the new Trace Document.

当 Instruments 启动时,您应该会看到一个屏幕,要求您为新的 Trace Document 选择一个模板。

Select: iPhone Simulator > Memory > Zombies

选择: iPhone Simulator > Memory > Zombies

Next you need to choose a target.

接下来,您需要选择一个目标。

Go to: Chose target > Chose target > Chose target...

去: Chose target > Chose target > Chose target...

Now you need to select the application file:
<Path to your iPhone project>/build/Debug-iphonesimulator/<Application name>
and press Chose.

现在您需要选择应用程序文件:
<Path to your iPhone project>/build/Debug-iphonesimulator/<Application name>
并按Chose

Now you are all set.

现在你已经准备好了。

To launch you application press the Recordbutton.

要启动您的应用程序,请按Record按钮。

A few Side Notes:

一些旁注

  • I used XCode 3.2.3 on Mac OS X 10.6.3, but I believe it works the same on previous versions.
  • The Zombies instrument only works with the simulator.
  • The Zombies instrument cannot be used with the Leaks instrument because all the zombies would appear as leaks.
  • I would also like to know why the menu in XCode is grayed out.
  • 我在 Mac OS X 10.6.3 上使用了 XCode 3.2.3,但我相信它在以前的版本上是一样的。
  • Zombies 仪器仅适用于模拟器。
  • Zombies 仪器不能与 Leaks 仪器一起使用,因为所有僵尸都会显示为泄漏。
  • 我也想知道为什么 XCode 中的菜单是灰色的。

回答by jer

Are you sure you're setting it in the right place? I mean, it is a runtime tuneable, not compile time. Just be sure you're setting it in the right place and try again.

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 surethe checkmark for the NSZombieEnabled entry is checked.

你确定你把它设置在正确的地方吗?我的意思是,它是一个运行时可调,而不是编译时。请确保您将其设置在正确的位置,然后重试。

转到 Project -> Edit Active Executable
单击 Arguments
在“要在环境中设置的变量”部分中单击 + 在
Name 列中输入 NSZombieEnabled,在 Value 列中输入 YES。
务必在NSZombieEnabled进入复选标记被选中。

回答by an0

As said by Apple engineers, most items under Run with Performance Tool need dTrace support, but dTrace is not available for iOS yet, not even for simulators.

正如苹果工程师所说,Run with Performance Tool 下的大多数项目都需要 dTrace 支持,但 dTrace 尚不适用于 iOS,甚至不适用于模拟器。

However, strangely, you can manually set up a template in Instruments to test zombies, as described by @florin

但是,奇怪的是,您可以在 Instruments 中手动设置模板来测试僵尸,如@florin 所述