iOS开发 快速定位约束冲突位置

开发过程中遇到约束冲突的报错:

2021-01-23 15:35:00.036312+0800 WisdomChain[1057:512850] [LayoutConstraints] Unable to simultaneously satisfy constraints.
    Probably at least one of the constraints in the following list is one you don't want. 
    Try this: 
        (1) look at each constraint and try to figure out which you don't expect; 
        (2) find the code that added the unwanted constraint or constraints and fix it. 
(
    ""
)

Will attempt to recover by breaking constraint 

1.先点击Debug View Hierarchy

Debug View Hierarchy

2.打印页控件层级和地址

Obj-C project

po [[UIWindow keyWindow] _autolayoutTrace]

Swift project

expr -l objc++ -O -- [[UIWindow keyWindow] _autolayoutTrace]

3.搜索报错的地址0x111e168f0,定位到错误控件

image.png

断点小技巧:

image.png
image.png

你可能感兴趣的:(iOS开发 快速定位约束冲突位置)