如何在 Xcode 8 中启用 Visual Memory Debugger?

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

How to enable Visual Memory Debugger in Xcode 8?

xcodeswiftcocoaxcode8

提问by PopKernel

I migrated a project from the previous version of Xcode to Xcode 8. What I want is to use the new visual memory debugger. It's available in new projects, but is entirely missing in my imported one. Why is this?

我将一个项目从以前版本的 Xcode 迁移到 Xcode 8。我想要的是使用新的可视化内存调试器。它在新项目中可用,但在我导入的项目中完全没有。为什么是这样?

采纳答案by gabriellanata

It appears that Swift 3 is required for Visual Memory Debugger to work.

看来 Visual Memory Debugger 需要 Swift 3 才能工作。

My app migrated to Swift 2.3 did not work, when I tried migrating it to Swift 3.0 it worked instantly.

我的应用程序迁移到 Swift 2.3 不起作用,当我尝试将它迁移到 Swift 3.0 时,它立即起作用了。

The runtime sanitization checkbox is not required for visual memory debugger to work, however the reason that it is disabled is the same.

运行时清理复选框不是可视化内存调试器工作所必需的,但是禁用它的原因是相同的。

回答by mangerlahn

It seems like the project requires Swift 3 to enable Adress & Thread Sanitizer (which is the Memory Debugger).

该项目似乎需要 Swift 3 才能启用 Adress & Thread Sanitizer(即内存调试器)。

address sanitizerthread sanitizer

地址消毒剂螺纹消毒剂

For me this applies to both iOS & OS X/macOS apps. Both written in Swift 2.2 & converted to 2.3.

对我来说,这适用于 iOS 和 OS X/macOS 应用程序。两者都用 Swift 2.2 编写并转换为 2.3。

Note: I only tested this on OS X El Capitan 10.11.5.

注意:我只在 OS X El Capitan 10.11.5 上测试过。

@gabriellanata confirms that it works when the code is converted to Swift 3.

@gabriellanata 确认当代码转换为 Swift 3 时它可以工作。

回答by Uladzimir

Argument '-sanitize=address' is not supported on the Swift 2.3 toolchain. 
You will need to migrate your project to Swift 3 to use this feature.

Xcode 8 GM build error

Xcode 8 GM 构建错误

P.S. Objective-c supported by Visual Memory Debugger

Visual Memory Debugger 支持的 PS Objective-c

回答by Rick

If you click on Memory, the source editor pane will change to show some memory information, including why it's disabled. In my case, it was because I had Zombie Objects enabled in the Scheme. (Xcode 8.3.2)

如果您单击内存,源代码编辑器窗格将更改以显示一些内存信息,包括禁用的原因。就我而言,这是因为我在 Scheme 中启用了 Zombie Objects。(Xcode 8.3.2)

回答by JAL

I just ran an Objective-C iOS 7 project made with Xcode 7 in Xcode 8 (without migrating) and the Visual Memory Debugger icon appears at the bottom of Xcode in the debugging area next to the Debug View Hierarchy button.

我刚刚在 Xcode 8 中运行了一个使用 Xcode 7 制作的 Objective-C iOS 7 项目(没有迁移),并且 Visual Memory Debugger 图标出现在 Xcode 底部调试区域中的 Debug View Hierarchy 按钮旁边。

Visual memory Debugger

视觉记忆调试器

It's the button with the three circles.

这是带有三个圆圈的按钮。

From the other comments, it looks like Swift 3 might be required to use this feature.

从其他评论来看,使用此功能可能需要 Swift 3。