swift 中 tableview 单元格的自动布局错误

Auto Layout error with tableview cell in swift

我将自动布局与 UITableViewCell 结合使用,但出现了以下错误。 我该如何解决?

2020-09-15 11:42:13.104796+0900 heart-to-heart[14602:1800620] [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. 
(
    "<NSLayoutConstraint:0x6000022eb890 UIImageView:0x7fdd1f01efc0.height == 50   (active)>",
    "<NSLayoutConstraint:0x6000022c7480 V:|-(16)-[UIImageView:0x7fdd1f01efc0]   (active, names: '|':UITableViewCellContentView:0x7fdd1f01eb00 )>",
    "<NSLayoutConstraint:0x6000022c74d0 V:[UIImageView:0x7fdd1f01efc0]-(16)-|   (active, names: '|':UITableViewCellContentView:0x7fdd1f01eb00 )>",
    "<NSLayoutConstraint:0x6000022c1d10 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7fdd1f01eb00.height == 82.3333   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x6000022eb890 UIImageView:0x7fdd1f01efc0.height == 50   (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.

如果您要为 ImageView 设置高度,则无需设置底部约束甚至顶部约束。移除 bottom 和 top 约束并将约束添加到 centerY,即将图像视图垂直居中到容器。

您遇到此问题的原因是,对于满足图像视图的高度约束或顶部/底部约束的约束不明确。