对于 iOS 和 OS X 开发者来说,Autolayout已经逐渐变成一个至关重要的开发工具。它让多屏幕适配变得小菜一碟(peasy),但是有些时候它还是会把我们搞疯掉,因为它总是会出现那些啰嗦又没啥用处的错误警告。
就像这样:
1 2 3 4 5 6 7 8 9 10 11 12 13
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)
(...........)
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch thisin the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.