这很令人惊讶,我不确定,但我的 Xcode 调试日志向我显示了一些随机约束错误,但是 Storyboard 文件中没有错误(并且它不会影响我的应用程序中的任何地方)。
我发布这个问题只是为了确保存在一些严重的问题或我身边遗漏了什么?
这是我的日志:
2016-02-04 17:46:17.432 MyApp[3586:198217] 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:0x7fe19aeebd00 V:[UIButton:0x7fe19aeedee0(44)]>",
"<NSLayoutConstraint:0x7fe19aef0cf0 V:[UIButton:0x7fe19aeedee0]-(-1)-| (Names: '|':UITableViewCellContentView:0x7fe19aeed8e0 )>",
"<NSLayoutConstraint:0x7fe19aef0d40 V:|-(0)-[UIButton:0x7fe19aeedee0] (Names: '|':UITableViewCellContentView:0x7fe19aeed8e0 )>",
"<NSLayoutConstraint:0x7fe19d007580 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fe19aeed8e0(44)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fe19aeebd00 V:[UIButton:0x7fe19aeedee0(44)]>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2016-02-04 17:46:17.434 MyApp[3586:198217] 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:0x7fe19d0124a0 V:[UIButton:0x7fe19d0121f0(44)]>",
"<NSLayoutConstraint:0x7fe19d014420 V:[UIButton:0x7fe19d0121f0]-(-1)-| (Names: '|':UITableViewCellContentView:0x7fe19d012060 )>",
"<NSLayoutConstraint:0x7fe19d014470 V:|-(0)-[UIButton:0x7fe19d0121f0] (Names: '|':UITableViewCellContentView:0x7fe19d012060 )>",
"<NSLayoutConstraint:0x7fe19d00bb90 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fe19d012060(44)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fe19d0124a0 V:[UIButton:0x7fe19d0121f0(44)]>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2016-02-04 17:46:17.435 MyApp[3586:198217] 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:0x7fe19d019820 V:[UIButton:0x7fe19d019570(44)]>",
"<NSLayoutConstraint:0x7fe19d01b7a0 V:[UIButton:0x7fe19d019570]-(-1)-| (Names: '|':UITableViewCellContentView:0x7fe19d0193e0 )>",
"<NSLayoutConstraint:0x7fe19d01b7f0 V:|-(0)-[UIButton:0x7fe19d019570] (Names: '|':UITableViewCellContentView:0x7fe19d0193e0 )>",
"<NSLayoutConstraint:0x7fe19d01f130 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fe19d0193e0(44)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fe19d019820 V:[UIButton:0x7fe19d019570(44)]>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2016-02-04 17:46:17.436 MyApp[3586:198217] 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:0x7fe19d020640 V:[UIButton:0x7fe19d020390(44)]>",
"<NSLayoutConstraint:0x7fe19d022460 V:[UIButton:0x7fe19d020390]-(-1)-| (Names: '|':UITableViewCellContentView:0x7fe19d020200 )>",
"<NSLayoutConstraint:0x7fe19d0224b0 V:|-(0)-[UIButton:0x7fe19d020390] (Names: '|':UITableViewCellContentView:0x7fe19d020200 )>",
"<NSLayoutConstraint:0x7fe19ac90e20 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fe19d020200(44)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fe19d020640 V:[UIButton:0x7fe19d020390(44)]>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2016-02-04 17:46:17.438 MyApp[3586:198217] 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:0x7fe19d027410 V:[UIButton:0x7fe19d027160(44)]>",
"<NSLayoutConstraint:0x7fe19d029390 V:[UIButton:0x7fe19d027160]-(-1)-| (Names: '|':UITableViewCellContentView:0x7fe19d026fd0 )>",
"<NSLayoutConstraint:0x7fe19d0293e0 V:|-(0)-[UIButton:0x7fe19d027160] (Names: '|':UITableViewCellContentView:0x7fe19d026fd0 )>",
"<NSLayoutConstraint:0x7fe19ac7da90 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fe19d026fd0(44)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fe19d027410 V:[UIButton:0x7fe19d027160(44)]>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2016-02-04 17:46:17.439 MyApp[3586:198217] 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:0x7fe19d02e2c0 V:[UIButton:0x7fe19d02e010(44)]>",
"<NSLayoutConstraint:0x7fe19d030240 V:[UIButton:0x7fe19d02e010]-(-1)-| (Names: '|':UITableViewCellContentView:0x7fe19d02de80 )>",
"<NSLayoutConstraint:0x7fe19d030290 V:|-(0)-[UIButton:0x7fe19d02e010] (Names: '|':UITableViewCellContentView:0x7fe19d02de80 )>",
"<NSLayoutConstraint:0x7fe19af28d90 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x7fe19d02de80(44)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x7fe19d02e2c0 V:[UIButton:0x7fe19d02e010(44)]>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
这是我的 Storyboard View 列表:
配置:
Xcode v.7.1.1
iOS v.9.1。
最佳答案
你给的约束在某处被打破了。这就是它显示错误的原因。因此,确定您不需要的约束并删除它们。 (例如,重复约束或没有任何意义的约束,例如您提供前导和尾随以及固定宽度。)
关于ios - Xcode 日志显示约束错误,但 Storyboard 文件中没有错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35200884/