Xcode 断点测试

我在进行断点调试的时候newDemo was compiled with optimization - stepping may behave oddly; variables may not be available.这种错误.再然后进行打印

error: Couldn't materialize: couldn't get the value of variable self: variable not available
error: errored out in DoExecute, couldn't PrepareToExecuteJITExpression

这种错误.为什么会出现这种错误?

阅读 4.2k
1 个回答

newDemo was compiled with optimization - stepping may behave oddly 说的是编译的时候做了优化,所以源代码和编译后的机器码没办法一一对应,断点调试使用机器码,对应不到,所以self变量找不到。

编译的时候不要选择 Release (发布)模式。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进