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

这是我得到的:

(lldb) po self.modalPresentationStyle
__C.UIModalPresentationStyle

如何获取变量的REAL值,而不是类型?

我可以通过执行以下命令对其进行“反向工程”:
(lldb) po self.modalPresentationStyle == .fullScreen
false

但是如何才能更快地达到预期的效果?

最佳答案

po命令要求对象提供其自身的描述。我不确定为什么UIModalPresentationStyle的快速对象描述只是打印其类型。那可能值得一个快速的bug。

但是,如果您要求lldb评估表达式并为您返回其值-而不是显示该值的对象说明-可以使用:

(lldb) p self.modalPresentationStyle
(UIModalPresentationStyle) $R0 = fullScreen

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

关于ios - LLDB:查看UIModalPresentationStyle枚举的真实值,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/52905334/

10-13 05:09