快速定位约束以及解决方法

1.  with错写成width语法错误 报错

     Assertion failure in -[MASViewConstraint addConstraintWithLayoutAttribute:], MASViewConstraint.m:213

     2021-02-25 16:30:12.261136+0800 Masonry[47431:9690200] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Attributes should be chained before defining the constraint relation'


2.  equalTo后面关联的view非同级视图或非者父视图 报错

     Assertion failure in -[MASViewConstraint setSecondViewAttribute:], MASViewConstraint.m:135

     2021-02-25 16:33:20.327230+0800 Masonry[48246:9697968] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'attempting to add unsupported attribute: '


3.  不能同时满足约束条件。报错  

     [LayoutConstraints] Unable to simultaneously satisfy constraints.


     make.edges.mas_equalTo(UIEdgeInsetsMake(10, 10, 10, 10)); 可以都为正数

     make.right.equalTo(self.view).with.offset(-10);  负数

     make.bottom.equalTo(self.view).with.offset(-10); 负数

1.可以添加优先级解决 2.删掉有冲突的约束 3.检查父视图width或高是否为0


     断点定位约束冲突控件

     symobol:UIViewAlertForUnsatisfiableConstraints

     debugger command: po [[[UIApplication sharedApplication] windows].firstObject recursiveDescription]

或 po [[UIWindow keyWindow] _autolayoutTrace] 

你可能感兴趣的:(快速定位约束以及解决方法)