无法从 Xcode 运行 Instruments

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1358874/
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:47:02  来源:igfitidea点击:

Can't run Instruments from Xcode

xcodeinstruments

提问by Boon

I recently upgraded to Snow Leopard and since then I am having difficulty running Instrument to instrument my app from Xcode. The Record button would be grayed out, and nothing happens. There is no message in Xcode's console telling me what's wrong either. I used to be able to attach it to process or launch the process from Instruments as well, all these are no longer working.

我最近升级到 Snow Leopard,从那时起我在运行 Instrument 以从 Xcode 检测我的应用程序时遇到了困难。Record 按钮将变灰,并且没有任何反应。Xcode 的控制台中也没有消息告诉我出了什么问题。我曾经能够将它附加到进程或从 Instruments 启动进程,所有这些都不再有效。

Any idea what's causing this?

知道是什么原因造成的吗?

回答by Anthony McCormick

I had the same issue! I could only use Instruments on my iPhone but not on iPad or iPad2! Whenever I started instruments with Xcode 4 it would just beep and the record button would be disabled..

我遇到过同样的问题!我只能在 iPhone 上使用 Instruments,而不能在 iPad 或 iPad2 上使用!每当我使用 Xcode 4 启动乐器时,它只会发出哔哔声并且录音按钮将被禁用。

I solved this issue by in XCode going to >Targets>Edit Scheme>Profile "yourAppName" and changing the Build Configuration from Release to Debug. Then try to profile again Product>Profile

我通过在 XCode 中转到 >Targets>Edit Scheme>Profile "yourAppName" 并将构建配置从 Release 更改为 Debug 解决了这个问题。然后再次尝试配置文件 Product>Profile

If you get the beep again.. You will see that it says "CHOOSE TARGET" next to the record button open the drop down >Choose Target> "yourAppName" then hit record.

如果你再次听到哔哔声..你会看到它在记录按钮旁边说“选择目标”,打开下拉菜单>选择目标>“你的应用程序名称”,然后点击记录。

This solved it for me and was finally able to run instruments again!

这为我解决了这个问题,终于能够再次运行仪器了!

I know this post is old but i hope it helps someone.

我知道这篇文章很旧,但我希望它可以帮助某人。

回答by Wayne Uroda

I was unable to get instruments to work with my iPhone (it had previously worked). The behaviour I saw was that xcode would say "finished running - Profiling [app name]" before the instruments window was even shown (the choose instrument window).

我无法让乐器与我的 iPhone 一起工作(它以前工作过)。我看到的行为是,xcode 会在甚至显示仪器窗口(选择仪器窗口)之前说“已完成运行 - 分析 [应用程序名称]”。

I worked around this by going to product->scheme->edit scheme, select profile [app name] and select an instrument (i.e. Allocations) under the instrument drop down (instead of "ask on launch").

我通过转到产品-> 方案-> 编辑方案,选择配置文件 [应用程序名称] 并在工具下拉列表下(而不是“启动时询问”)选择一个工具(即分配)来解决这个问题。

Once I did this, selecting Product->profile worked for me and the instruments was running.

完成此操作后,选择 Product->profile 对我有用,并且仪器正在运行。

I wanted the zombie instrument which strangely isn't in the xcode dropdown, I was able to use this by simply using file->new in instruments (while the allocations instrument was still connected and running) and I could then choose the zombies instrument and the record button wasn't greyed out!

我想要奇怪的是不在 xcode 下拉列表中的僵尸工具,我可以通过简单地在工具中使用 file->new 来使用它(而分配工具仍然连接并运行),然后我可以选择僵尸工具和录制按钮没有变灰!

All of this was with iOS 7.0.3 and xcode 5.0.1.

所有这些都是在 iOS 7.0.3 和 xcode 5.0.1 上完成的。

I hope this helps at least one other person to stop ripping their hair out, but knowing xcode I somehow doubt it!

我希望这至少可以帮助其他人停止扯掉他们的头发,但是知道 xcode 我不知何故怀疑它!

回答by Bill

I had this issue in Xcode 7. It turned out that, somehow, in the Profile section of my scheme settings, the Executable field had been cleared:

我在 Xcode 7 中遇到了这个问题。结果是,不知何故,在我的方案设置的 Profile 部分,Executable 字段已被清除:

enter image description here

在此处输入图片说明

I set the Executable field to my target name and the menu enabled again.

我将 Executable 字段设置为我的目标名称并再次启用菜单。

回答by Honey

The problem is instrument needs a gateway to your app and simply pointing to it doesn't do it. The Instrument's workflowis as such: enter image description hereYou need to profileit from Xcode first.

问题是仪器需要一个通往您的应用程序的网关,而仅仅指向它并不能做到。该仪器的工作流程是这样: 在此处输入图片说明你需要配置文件先从Xcode的

enter image description here

在此处输入图片说明

I highly recommend seeing Apple's own links shared in this answer. They are amazingly good and simple.

我强烈建议您查看此答案中共享的 Apple 自己的链接。它们非常好和简单。

Apple's documentationsays

苹果的文档

If Instruments has access to information about your app's source code, a leak is reported as a class name. Otherwise, a leak is reported as a memory address, such as Malloc-size. To ensure that Instruments has access to information about your code, initiate profiling from Xcode(see Profile from Xcode) or configure a symbol mappings file (see Map Data to Source Code).

如果 Instruments 可以访问有关您的应用程序源代码的信息,则会将泄漏报告为类名。否则,泄漏将报告为内存地址,例如 Malloc-size。为了确保 Instruments 可以访问有关您的代码的信息,请从 Xcode启动分析(请参阅来自 Xcode 的分析)或配置符号映射文件(请参阅将数据映射到源代码)。

回答by Richard

I had the same problem after reinstalling Snow Leopard last week. I moved my /Developer folder to /Developer_old and re-ran the Xcode installer pkg, and now have Instruments back.
HTH

上周重新安装雪豹后,我遇到了同样的问题。我将我的 /Developer 文件夹移动到 /Developer_old 并重新运行 Xcode 安装程序包,现在仪器又回来了。
HTH

回答by CocoaChris

Note that if you have multiple targets, it is very likely that you need indeed to tell Xcode which one you want to profile. Use the edit targets scheme above

请注意,如果您有多个目标,则很可能确实需要告诉 Xcode 您要分析哪个目标。使用上面的编辑目标方案

回答by Willy

As pointed out in Apple's discussion forum, restarting your machine works. It works for me.

正如Apple 的讨论论坛中所指出,重新启动您的机器可以工作。这个对我有用。

回答by GilesDMiddleton

I've noticed that if I go to File->Record options, and press OK, the record button suddenly is enabled.

我注意到,如果我转到“文件”->“录制选项”,然后按“确定”,录制按钮会突然启用。

回答by Tal Haham

Make sure all of your instruments support recording modes. When I upgraded from Xcode6 to Xcode7, one of my instruments was marked as "This instrument's supported recording modes are none". When I deleted this specific instrument, the recording button becomed enabled.

确保您的所有乐器都支持录音模式。当我从 Xcode6 升级到 Xcode7 时,我的一个仪器被标记为“该仪器支持的录音模式为无”。当我删除这个特定的乐器时,录音按钮被启用。