本文共 760 字,大约阅读时间需要 2 分钟。
在Xcode断点调试的时候,在控制台输入id类型的时候就死翘翘了。例如:
po self.view.frameerror: property 'frame' not found on object of type 'UIView *'error: 1 errors parsing expression
解决问题:
打开终端输入三条命令:
1 2 3 | $touch ~/.lldbinit $echo display @import UIKit >> ~/.lldbinit $echo target stop-hook add -o \"target stop-hook disable\" >> ~/.lldbinit |
重新运行项目,再次断点使用po,你会发现下图:
删除
rm ~/.lldbinit
在维护项目和进行二次开发时,经常debug要找出这个view或者button响应的方法,虽然打断点追踪或者直接看源码也能找出button的target,但是这样效率是很慢的,现在有一个LLDB命令可以再运行时添加一个响应事件的断点,步骤如下:
1) 在App运行时点击pause program execution 便会暂停app,在此就可以输入LLDB命令。
2)在LLDB控制台中输入命令 : br s -r . -s Demo1(Demo1是项目名,每个人得不同) 并且响应Breakpoint XXX locations 就代表成功了. 3) 回到app中, 点击你要查看某一个view or button的响应 4) 然后在回到Xcode的控制台中点击continue 按钮就能跳转到你所点击view的响应方法参考:
转载地址:http://iumum.baihongyu.com/