-->

如何快速检查在Xcode 4.6.X任意变量的值?(How do I quickly inspect

2019-08-22 17:24发布

它看起来相当普遍承认, 它是缓慢的使用po在Xcode 4.6.X命令 。 什么是编译时未指定检查任何变量的值的选项(这就排除了使用情况NSLog()它不采取> 15秒?

Answer 1:

只要设定要了解变量的值断点。 一旦程序被暂停,所有变量的值的摘要将出现在Varibles view在屏幕的左下方。 下面是截图:



Answer 2:

您可以使用LLDB命令:

p (int) myInt
po myObject
po myObject.memberObject
p (float) myObject.floatMember

只是注意,你也可以请使用P代替PO在Xcode的最新版本。 如果您运行help -a在LLB,它会为你展示命令别名,以下是你可以使用命令的片断。

> (lldb) help -a  
p         -- ('expression --')  Evaluate a C/ObjC/C++ expression in the current
         program context, using user defined variables and variables
         currently in scope.  

po        -- ('expression -o  --')  Evaluate a C/ObjC/C++ expression in the
         current program context, using user defined variables and
         variables currently in scope  

print     -- ('expression --')  Evaluate a C/ObjC/C++ expression in the current
         program context, using user defined variables and variables
         currently in scope.


Answer 3:

原来,答案很简单:下载的Xcode 4.6.2,其中LLDB调试速度已经显著上升。 注意在一些讨论在这里



文章来源: How do I quickly inspect the value of an arbitrary variable in Xcode 4.6.x?