内存分析不适用于 Xcode 9

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

Memory profiling doesn't work with Xcode 9

iosxcodeinstrumentsxcode9

提问by Tamás Sengel

I am using the latest version of Xcode 9 and macOS 10.13.

我使用的是最新版本的 Xcode 9 和 macOS 10.13。

When I try to make a memory graph from the current state of my application, it shows an empty screen that says No Selection.

当我尝试根据应用程序的当前状态制作内存图时,它会显示一个空屏幕,上面写着No Selection

"No selection" title after trying to create a memory graph

尝试创建内存图后的“无选择”标题

I also tried to profile and work with Instruments, but it did not allow me to run due to a permission error.

我还尝试分析和使用 Instruments,但由于权限错误,它不允许我运行。

Target failed to run.

Permission to debug [app name] was denied.

目标无法运行。

调试 [应用名称] 的权限被拒绝。

I am aware of these threadsand tried the suggestions available in them, but they didn't seem to work:

知道这些线程并尝试了其中可用的建议,但它们似乎不起作用

Things that I tried:

我尝试过的事情:

  • Restarting Xcode
  • Emptying the Derived Data folder
  • Cleaning the project
  • Cleaning the Build folder
  • Modifying the scheme's application environment to Debug instead of Release
  • Manually managing provisioning profiles and selecting Development profiles for Debug and Release
  • Trying simulators with different OS versions (iOS 11, iOS 10)
  • 重启Xcode
  • 清空派生数据文件夹
  • 清理项目
  • 清理构建文件夹
  • 修改方案的应用环境为Debug而不是Release
  • 手动管理配置文件并为调试和发布选择开发配置文件
  • 尝试使用不同操作系统版本的模拟器(iOS 11、iOS 10)

Looks like it's a specific issue with Xcode 9.

看起来这是 Xcode 9 的一个特定问题。

Are there any workarounds for this issue?

是否有针对此问题的解决方法?

采纳答案by Tamás Sengel

Updating Xcode to 9.2solved this problem for me.

将 Xcode 更新到 9.2为我解决了这个问题。

回答by Tamás Sengel

I tried building the application on a physical deviceand it worked, hovever, the memory graph did not show my Swift classes (for e.g., my controllers were simply not there). Allocation observing worked fine with Instruments, nonetheless.

我尝试在物理设备上构建应用程序并且它工作正常,但是,内存图没有显示我的 Swift 类(例如,我的控制器根本不存在)。尽管如此,分配观察与仪器一起工作得很好。

It seems like this is an issue caused by the simulator.

这似乎是由模拟器引起的问题。

回答by Ankit Vyas

In My Case I was Using Xcode 9. When I have checked to Xcode-> Preferences->Locations->Command Line Tools = Xcode 8.3.3 so I just Changed from Xcode 8.3.3 to Xcode 9.0 and It starts working.

在我的情况下,我使用的是 Xcode 9。当我检查 Xcode-> Preferences->Locations->Command Line Tools = Xcode 8.3.3 所以我只是从 Xcode 8.3.3 更改为 Xcode 9.0 并开始工作。

回答by lucasl

In my case the Build Configuration for Profiling was set to Release instead of Debug in the Scheme. After changing it, I could just profile in the Simulator.

在我的情况下,分析的构建配置设置为发布而不是方案中的调试。更改后,我可以在模拟器中进行配置文件。

Hope this helps.

希望这可以帮助。