我真的不知道为什么在这个特定的项目中我的调试器非常“禁用”.
例如,我想获取一个对象的信息:
(lldb)po [_model dictionaryValue]
[没有Objective-C描述]
我想知道为什么会这样.它使调试非常困难,而且只在当前的项目上进行.我猜我在某些时候已经对设置做了些什么.它几乎在我尝试检查的任何po someObject上.但是,可以在调试控制台左侧的窗格中看到范围中的变量.
我在Xcode 5上,我的项目中有Cocoapods,它是一个单元测试目标.
任何见解或任何解决方法?
更新:
为清楚起见,部分测试用例如何实现:
@interface WWCGateModelTests : XCTestCase { WWCGate *_model; } @end @implementation WWCGateModelTests - (void)setUp { [super setUp]; // Put setup code here; it will be run once,before each test case. _model = [WWCGate loadGateModelWithIdentifier: kGateName]; // defined,not nil } - (void)tearDown { [super tearDown]; NSError *error = nil; [_model saveModelOrError:&error]; // Breakpoint here. po _model does not print the model. // This has been possible with other projects... po error will print // nil to the console. How is an ivar not in scope? }
解决方法
这很可能发生,因为单元测试目标通常设置为使用“发布”配置运行. “释放”配置是调试符号被剥离或优化的配置.
我怀疑如果你确定你正在运行你的应用程序的非优化,符号就地调试版本,你就不会遇到这个问题.您可以在Xcode的方案编辑器中更改它(例如,在执行“Test”或“Profile”时,使用“Debug”配置).