两个不冲突的约束创建 NSLayoutConstraint 错误

Two non-conflicting constraints creating a NSLayoutConstraint error

我对将前导和尾部固定到超级视图的 UILabel 有两个约束。

问题是,当我在应用程序中打开视图时,出现此错误:

2015-04-11 22:00:24.319 TradingPost[7610:60b] 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. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
"<NSLayoutConstraint:0x17e9da10 H:[UILabel:0x17ef3ca0]-(12)-|   (Names: '|':UITableViewCellContentView:0x17eaceb0 )>",
"<NSLayoutConstraint:0x17e9da40 H:|-(88)-[UILabel:0x17ef3ca0]   (Names: '|':UITableViewCellContentView:0x17eaceb0 )>",
"<NSAutoresizingMaskLayoutConstraint:0x17eb1b00 h=--& v=--& H:[UITableViewCellContentView:0x17eaceb0(0)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x17e9da10 H:[UILabel:0x17ef3ca0]-(12)-|   (Names: '|':UITableViewCellContentView:0x17eaceb0 )>

然后它继续发挥作用,就好像所有约束都在按照预期的功能运作一样。

为清楚起见,这是我的约束的屏幕截图:

我猜你正在使用 UITableView 并创建自定义单元格。
创建 UITableViewCell 的子 class,将 class 分配给您的自定义单元格并覆盖 awakeFromNib,如下所示:

- (void)awakeFromNib {
    [super awakeFromNib];
    self.contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
}