美文网首页
Unable to simultaneously satisfy

Unable to simultaneously satisfy

作者: BetterComingDay | 来源:发表于2017-03-13 14:06 被阅读52次
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.
(
    "<NSLayoutConstraint:0x7fbb85999770 V:[UIView:0x7fbb85e8f850(1)]>",
    "<NSLayoutConstraint:0x7fbb85e24e80 V:[UIView:0x7fbb85e8f570(1)]>",
    "<NSLayoutConstraint:0x7fbb85e6f500 V:[UIImageView:0x7fbb85e79b80(200)]>",
    "<NSLayoutConstraint:0x7fbb83758b80 V:[UIView:0x7fbb85da7610(44)]>",
    "<NSLayoutConstraint:0x7fbb8375a240 V:|-(0)-[UIView:0x7fbb85e8f850]   (Names: '|':UIView:0x7fbb85e78d40 )>",
    "<NSLayoutConstraint:0x7fbb8375a330 V:[UIView:0x7fbb85e8f850]-(20)-[UILabel:0x7fbb85e7e8a0'\U5c0f\U5446\U74dc\U6eda\U5440\U6eda']>",
    "<NSLayoutConstraint:0x7fbb8375a470 V:[UILabel:0x7fbb85e7e8a0'\U5c0f\U5446\U74dc\U6eda\U5440\U6eda']-(5)-[UILabel:0x7fbb8599abf0'\U6765\U81ea \U5c0f\U7ec4[\U60a6\U53cb\U4f1a]']>",
    "<NSLayoutConstraint:0x7fbb8375a510 V:[UILabel:0x7fbb8599abf0'\U6765\U81ea \U5c0f\U7ec4[\U60a6\U53cb\U4f1a]']-(12)-[UILabel:0x7fbb85e807d0'\U7f8e\U56fd\Uff0c\U6cd5\U56fd\U548c\U4e2d\U56fd\U5973\U4eba\U8981\U51cf\U80a5\U7684\U65f6\U5019']>",
    "<NSLayoutConstraint:0x7fbb8375a650 V:[UILabel:0x7fbb85e807d0'\U7f8e\U56fd\Uff0c\U6cd5\U56fd\U548c\U4e2d\U56fd\U5973\U4eba\U8981\U51cf\U80a5\U7684\U65f6\U5019']-(12)-[UIView:0x7fbb85e8f570]>",
    "<NSLayoutConstraint:0x7fbb8375a740 V:[UIView:0x7fbb85e8f570]-(12)-[UILabel:0x7fbb85e7fba0'\U7f8e\U56fd']>",
    "<NSLayoutConstraint:0x7fbb8375a790 V:[UILabel:0x7fbb85e7fba0'\U7f8e\U56fd']-(12)-[UIImageView:0x7fbb85e79b80]>",
    "<NSLayoutConstraint:0x7fbb8375a880 V:[UIImageView:0x7fbb85e79b80]-(3)-[UILabel:0x7fbb85e90010]>",
    "<NSLayoutConstraint:0x7fbb8375a8d0 V:[UILabel:0x7fbb85e90010]-(0)-[UIView:0x7fbb85da7610]>",
    "<NSLayoutConstraint:0x7fbb8375a920 V:[UIView:0x7fbb85da7610]-(0)-|   (Names: '|':UIView:0x7fbb85e78d40 )>",
    "<NSLayoutConstraint:0x7fbb8375b0d0 V:|-(0)-[UIView:0x7fbb85e78d40]   (Names: '|':UITableViewCellContentView:0x7fbb859a4e90 )>",
    "<NSLayoutConstraint:0x7fbb8375b170 UITableViewCellContentView:0x7fbb859a4e90.bottomMargin == UIView:0x7fbb85e78d40.bottom - 8>",
    "<NSLayoutConstraint:0x7fbb85a75650 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fbb859a4e90(297.5)]>"``
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fbb85e6f500 V:[UIImageView:0x7fbb85e79b80(200)]>

看到开头的报错信息, 是说不能同时满足我的约束条件,让我从下面列出的的约束条件中找出我不想要的,然后修复它。 于是我就挨个检查了每个约束条件, 去掉了不必要的约束条件, 但仍是一直报错。 最后发现了这句话:
Will attempt to recover by breaking constraint 这句话是说尝试打破下面的约束来进行修复, 这才找到问题所在。 对于这个这个UIImageView 我在cell中约束的值的高度是100,但是在实际的使用中,它的实际值却是200 ,所以会有约束冲突报错。
解决的办法就是降低这个约束的优先级(Priority),当系统实际计算 的高度与我设置的约束值不一样时, 取系统的值, 就不会再报错了。
修改方式如下:
选中要修改的约束,将其值调低(999)即可。

Snip20170313_3.png

相关文章

网友评论

      本文标题:Unable to simultaneously satisfy

      本文链接:https://www.haomeiwen.com/subject/jiwfnttx.html