如何使用Swift调试我的iOS应用程序

时间:2022-11-06 07:19:58

I started building my first iOS app and I am trying to debug it. I set a break point on my viewDidLoad() function (line 14) like so: 如何使用Swift调试我的iOS应用程序

我开始构建我的第一个iOS应用程序,我正在尝试调试它。我在viewDidLoad()函数(第14行)上设置了一个断点,如下所示:

When I run the app and the get the ViewController to load, my debugger view opens in xcode but I am getting this (what looks like assembly code) view. 如何使用Swift调试我的iOS应用程序

当我运行应用程序并加载ViewController时,我的调试器视图在xcode中打开,但我得到了这个(看起来像汇编代码)视图。

I can't seem to figure out how to view the debugger in my Swift code and be able to step through it in Swift. Does anyone know how to accomplish this? Thanks!

我似乎无法弄清楚如何在我的Swift代码中查看调试器并能够在Swift中逐步完成它。有谁知道如何做到这一点?谢谢!

2 个解决方案

#1


I found the issue.

我发现了这个问题。

Debug > Debug Workflow > "Always Show Disassembly" was checked off. Unchecking this now shows my source code when debugging.

已选中“调试”>“调试工作流”>“始终显示反汇编”。取消选中此功能现在会在调试时显示我的源代码。

#2


You should set the breakpoint on a line of code inside the method and not the call to the super class. Then you'll be able to analyze variables at the breakpoint.

您应该在方法内的一行代码上设置断点,而不是对超类的调用。然后,您将能够在断点处分析变量。

#1


I found the issue.

我发现了这个问题。

Debug > Debug Workflow > "Always Show Disassembly" was checked off. Unchecking this now shows my source code when debugging.

已选中“调试”>“调试工作流”>“始终显示反汇编”。取消选中此功能现在会在调试时显示我的源代码。

#2


You should set the breakpoint on a line of code inside the method and not the call to the super class. Then you'll be able to analyze variables at the breakpoint.

您应该在方法内的一行代码上设置断点,而不是对超类的调用。然后,您将能够在断点处分析变量。