po [<view> recursiveDescription]
问题
UITextView 无法在视图 Debug 中显示
Assertion failure in -[UITextView _firstBaselineOffsetFromTop]
Solution
// It is an issue of UITextView.
// Add a category of UITextView and add the lines below to the .m file.
// Only import when debug mode.
- (void)_firstBaselineOffsetFromTop {
}
- (void)_baselineOffsetFromBottom {
}
当视图的约束出现错误的时候,控制台在出错约束的最后会提示
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
⌘ + 7
,转到 Show the Breakpoint navigator右下角添加 Symbolic Breakpoint…
在弹出的对话框中填入配置
Action 的 Debugger Command
expr -l objc++ -O -- [[UIWindow keyWindow] _autolayoutTrace]
po [[UIWindow keyWindow] _autolayoutTrace]
在运行时,当遇到有异常的约束时,会自动停下,并可以实时改变控件的属性,如
(lldb) expr ((UIView *)0x7f9ea3d43410).backgroundColor = [UIColor redColor]