在运行时调整参数?

MCK*_*pur 3 debugging objective-c ios lldb

在使用iOS时,我有时会有需要测试的值.我可能会调整这些值30次,并且必须重建/重新运行30次才能测试它们.这是一个明显的麻烦.

所以我想知道(使用iOS SDK)是否可以在应用程序的运行时调整小参数/数据?只是为了让生活更方便.

War*_*shi 7

  1. 设置一个 BreakPoint
  2. lldb调试区域类型中:

例1:

expr (void)[aView setBackgroundColor:(UIColor*)[UIColor redColor]]
Run Code Online (Sandbox Code Playgroud)

这里,aViewUIView为这我想看看它的运行时框架.我在运行时调用setBackgroundColor方法UIView.可以像这样调用任何方法.

例2:

expr nsstringVariable = @"yourRunTimeValue"
Run Code Online (Sandbox Code Playgroud)

在这里,我在运行时更改字符串变量.

有关expr类型的更多帮助

help expr

我强烈建议人们通过使用Xcode 4.5进行中间调试来阅读本教程Brian Moakley