在 XCode Profiler 中注册应用程序以进行符号化

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

Register App for Symbolication in XCode Profiler

objective-ciosxcode

提问by bendytree

I'm trying to run XCode's time profiler on my app that is running on my device, but the symbol names show up like 0x2fe26643instead of [MyClass myMethod]. I realize I need to re-symbolicate the app, but I don't know how.

我正在尝试在我的设备上运行的应用程序上运行 XCode 的时间分析器,但符号名称显示0x2fe26643[MyClass myMethod]. 我意识到我需要重新符号化应用程序,但我不知道如何。

A few answers like thisand thissay to press "Re-Symbolicate", find your binary in the list, then press "Locate" to find the dSYM manually. My app is not in the list called dSYM Locations:

像这样这样的一些答案说要按“重新符号化”,在列表中找到您的二进制文件,然后按“定位”手动查找 dSYM。我的应用程序不在名为的列表中dSYM Locations

enter image description here

在此处输入图片说明

How I can get my results symbolicated?

我怎样才能得到我的结果符号化?

UPDATE:I posted a YouTube clip of what it looks like when I try to re-symbolicate: http://www.youtube.com/watch?v=CcLGRNkmako

更新:我发布了一个 YouTube 剪辑,展示了我尝试重新符号化时的样子:http: //www.youtube.com/watch?v=CcLGRNkmako

回答by Dav Yaginuma

I was having this same problem when trying to profile my app on device (worked fine in simulator). When trying to re-symbolicate, my app binary was not showing up at all under the "dSYM Locations" dialog list, so I wasn't able to select it and then use the Locate button to associate the appropriate dSYM as other answers have suggested.

我在尝试在设备上分析我的应用程序时遇到了同样的问题(在模拟器中运行良好)。尝试重新符号化时,我的应用程序二进制文件根本没有显示在“dSYM 位置”对话框列表下,因此我无法选择它,然后使用“定位”按钮关联适当的 dSYM,因为其他答案建议.

I was able to get symbolication back in the device profiling by going to Edit Scheme in Xcode and changing the Profile build to Debug instead of Release.

通过转到 Xcode 中的 Edit Scheme 并将 Profile build 更改为 Debug 而不是 Release,我能够在设备分析中重新获得符号。

回答by fishinear

Here is what I did to enable profiling, without switching to debug mode. This is for Xcode 4.5.1

这是我为启用分析所做的工作,而无需切换到调试模式。这是针对 Xcode 4.5.1

  1. Create a new "Profile" build configuration, based on the existing "Release" configuration: Select the project in the project navigator to open the project editor. Select the project in the project editor and click the Info button. Expand the Configurations section in the Info pane and click the Add (+) button at the bottom of the section. Select the existing "Release" configuration from the pop-up menu as a starting point for the new configuration. Select the name of the copy and type "Profile". See more in the Xcode User Guide.

  2. Set the Code Signing Identity of the "Profile" configuration to "iPhone Developer" (or the same as your "Debug" configuration): Click the Build Settings button to display the build settings for the project. To change the build settings in the new configuration for all the targets in the project, edit them at the project level. To change the build settings for an individual target, select that target. If you edit them at the project level, make sure that you double-check the target level afterwards: target settings override project settings. The Code Signing Identity is in the "Code Signing" section.

  3. Make sure that the "Generate Debug Symbols" setting is YES for the "Profile" configuration. It was already YES in my case.

  4. Set your new "Profile" configuration to be used by the "Profile" scheme: Select "Product->Edit Scheme" from the menu, select the "Profile appname.app" tab at the left, and then select the "Profile" under "Build Configuration".

  5. In your appname.entitlements file set the "get-task-allow" property to YES.

  6. Press the ALT key, and select "Product->Clean Build Folder" from the menu.

  7. Now select "Product->Profile" from the menu, and you should be good to go.

  1. 创建一个新的“Profile”构建配置,基于现有的“Release”配置:在项目导航器中选择项目以打开项目编辑器。在项目编辑器中选择项目并单击信息按钮。展开信息窗格中的配置部分,然后单击该部分底部的添加 (+) 按钮。从弹出菜单中选择现有的“发布”配置作为新配置的起点。选择副本的名称并键入“配置文件”。在Xcode 用户指南 中查看更多信息。

  2. 将“Profile”配置的 Code Signing Identity 设置为“iPhone Developer”(或与您的“Debug”配置相同):单击 Build Settings 按钮以显示项目的构建设置。要更改项目中所有目标的新配置中的构建设置,请在项目级别编辑它们。要更改单个目标的构建设置,请选择该目标。如果您在项目级别编辑它们,请确保之后仔细检查目标级别:目标设置覆盖项目设置。代码签名标识位于“代码签名”部分。

  3. 确保“配置文件”配置的“生成调试符号”设置为“是”。在我的情况下已经是肯定的。

  4. 设置新的“Profile”配置以供“Profile”方案使用:从菜单中选择“Product->Edit Scheme”,选择左侧的“Profile appname.app”选项卡,然后选择下方的“Profile” “构建配置”。

  5. 在您的 appname.entitlements 文件中,将“get-task-allow”属性设置为 YES。

  6. 按 ALT 键,然后从菜单中选择“Product->Clean Build Folder”。

  7. 现在从菜单中选择“Product->Profile”,你应该很高兴了

All kinds of strange things can happen if you don't do all of this. I have had no symbols show up at all, or only library symbols show up. I have had symbols only showing up if you first do a debug build, and then profile afterwards (which means the symbols are probably incorrectly taken from the debug build). I have had the profiler complaining about UUID mismatch, and I have had the infamous "Entitlements do not match" error (see more on that here).

如果你不做这一切,各种奇怪的事情都会发生。我根本没有显示任何符号,或者只显示库符号。我只有在您首先进行调试构建时才会显示符号,然后进行分析(这意味着符号可能错误地从调试构建中获取)。我让探查器抱怨 UUID 不匹配,并且我遇到了臭名昭著的“权利不匹配”错误(在此处查看更多信息)。

回答by Rob Napier

They mean to press the "Locate" button and then find your app in ~/Library/Developer/Xcode/DerivedData. I've found, however, that the following seems to work:

他们的意思是按下“定位”按钮,然后在~/Library/Developer/Xcode/DerivedData. 但是,我发现以下内容似乎有效:

  • Preferences > Search Paths
  • Add ~/Library/Developer/Xcode/DerivedData(I actually have this as /Users/rnapier/..., so I'm not certain if ~ works)
  • 首选项 > 搜索路径
  • 添加~/Library/Developer/Xcode/DerivedData(我实际上将它作为 /Users/rnapier/...,所以我不确定 ~ 是否有效)

This still doesn't always auto-symbolicate for me. But it lets me use File>Re-Symbolicate Document, and then just hit the "Symbolicate" button and it's been working for me. The fact that this doesn't work "out of the box" is insane....

这对我来说仍然并不总是自动象征。但它让我使用文件>重新符号化文档,然后只需点击“符号化”按钮,它就一直在对我来说有效。这不能“开箱即用”的事实是疯狂的......

I recommend duping radr://10158512(which is itself a duplicate of 10015727, but that one isn't in openradar).

我建议重复 radr://10158512(它本身是 10015727 的副本,但那个不在 openradar 中)。

回答by quellish

This also depends on where XCode is putting your build. You can select "MyCoolApp.app" in the XCode project organizer, right or control-click for "Show in Finder". Not all project settings will put it in DerivedData (several different project settings can conspire to put it in different locations). Now that you've found where XCode is depositing your builds, you can try adding it to Instruments from there using the steps previously outlined. When the File dialog comes up from clicking "Locate...", you can just drop the .app from the Finder on the File dialog and it will go to that directory.

这也取决于 XCode 将您的构建放在哪里。您可以在 XCode 项目管理器中选择“MyCoolApp.app”,右键或按住 Control 单击“在 Finder 中显示”。并不是所有的项目设置都会把它放在 DerivedData 中(几个不同的项目设置可以合谋把它放在不同的位置)。现在您已经找到了 XCode 存放构建的位置,您可以尝试使用前面概述的步骤从那里将其添加到 Instruments。当单击“定位...”出现“文件”对话框时,您只需将“文件”对话框中的 Finder 中的 .app 拖放到该目录即可。

回答by edelaney05

If you change the code signing identity for your "Release" build configuration from "Automatic Profile Selector: iPhone Distribution" to "Automatic Profile Selector: iPhone Development" (emphasis mine) then your app's binary will be listed in Instrument's Re-Symbolicate sheet and you can point it at your Derived Data folder.

如果您将“发布”构建配置的代码签名标识从“自动配置文件选择器:iPhone分发”更改为“自动配置文件选择器:iPhone开发”(重点是我的),那么您的应用程序的二进制文件将列在 Instrument 的重新符号表中,并且您可以将其指向派生数据文件夹。

回答by Schoob

No success with above mentioned. What worked for me with Xcode 5:

上面提到的没有成功。什么对我有用 Xcode 5:

  • Get location of your product as described in quellish's answer. Ex.

    /Users/ME/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos /Users/ME/Library/Developer/Xcode/DerivedData/Build/Products/Release-iphoneos

  • Open Instruments Preferences and add the location(s) in "dSYMs And Paths".

  • 按照 quellish 的回答中的描述获取产品的位置。前任。

    /Users/ME/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphoneos /Users/ME/Library/Developer/Xcode/DerivedData/Build/Products/Release-iphoneos

  • 打开 Instruments Preferences 并在“dSYMs And Paths”中添加位置。