LLDB:查看 UIModalPresentationStyle 枚举的实际值

Ric*_*hiy 2 debugging xcode ios lldb

在使用为 实例的方法设置的断点进行调试时UIViewController,我决定检查 的值UIModalPresentationStyle

这是我得到的:

(lldb) po self.modalPresentationStyle
__C.UIModalPresentationStyle
Run Code Online (Sandbox Code Playgroud)

如何获取变量的实际值,而不是其类型?

我可以通过执行以下命令对其进行“逆向工程”:

(lldb) po self.modalPresentationStyle == .fullScreen
false
Run Code Online (Sandbox Code Playgroud)

但怎样才能更快达到想要的结果呢?

Jim*_*ham 5

po命令向对象询问其自身的描述。我不确定为什么 UIModalPresentationStyle 的快速对象描述只打印其类型。这可能值得快速修复。

但是,如果您要求 lldb 计算表达式并为您返回其值 - 而不是提供该值的对象的描述 - 使用:

(lldb) p self.modalPresentationStyle
(UIModalPresentationStyle) $R0 = fullScreen
Run Code Online (Sandbox Code Playgroud)

有时您会得到更有用的答案。