从数据任务获取结果后,我试图动态设置navigationItem.prompt。当datatask完成时,来自datatask本身的数据会在表视图中列出,并且应该在navigationItem.prompt中显示该表视图中要列出的项目数。
但是,当尝试将提示从nil设置为String时,出现下面的LayoutConstraint警告。
经过研究,我发现了一个类似的示例for more reading (请参见延迟任务执行)。在显示初始视图并等待设置提示后,也会显示相同的警告。
2019-07-29 13:48:58.337732+0200 GooglyPuff[34677:3058108] [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.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x600003c852c0 h=--& v=--& _UINavigationBarModernPromptView:0x7ff015c26540.width == 0 (active)>",
"<NSLayoutConstraint:0x600003c84e10 UILabel:0x7ff015e24660'Add photos with faces to ...'.centerX == _UINavigationBarModernPromptView:0x7ff015c26540.centerX (active)>",
"<NSLayoutConstraint:0x600003c850e0 UILabel:0x7ff015e24660'Add photos with faces to ...'.trailing <= UILayoutGuide:0x6000026bc000'UIViewLayoutMarginsGuide'.trailing (active)>",
"<NSLayoutConstraint:0x600003c84f50 'UIView-rightMargin-guide-constraint' H:[UILayoutGuide:0x6000026bc000'UIViewLayoutMarginsGuide']-(20)-|(LTR) (active, names: '|':_UINavigationBarModernPromptView:0x7ff015c26540 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x600003c850e0 UILabel:0x7ff015e24660'Add photos with faces to ...'.trailing <= UILayoutGuide:0x6000026bc000'UIViewLayoutMarginsGuide'.trailing (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.
2019-07-29 13:48:58.339602+0200 GooglyPuff[34677:3058108] [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.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x600003c852c0 h=--& v=--& _UINavigationBarModernPromptView:0x7ff015c26540.width == 0 (active)>",
"<NSLayoutConstraint:0x600003c84e10 UILabel:0x7ff015e24660'Add photos with faces to ...'.centerX == _UINavigationBarModernPromptView:0x7ff015c26540.centerX (active)>",
"<NSLayoutConstraint:0x600003c84fa0 UILabel:0x7ff015e24660'Add photos with faces to ...'.leading >= UILayoutGuide:0x6000026bc000'UIViewLayoutMarginsGuide'.leading (active)>",
"<NSLayoutConstraint:0x600003c84eb0 'UIView-leftMargin-guide-constraint' H:|-(20)-[UILayoutGuide:0x6000026bc000'UIViewLayoutMarginsGuide'](LTR) (active, names: '|':_UINavigationBarModernPromptView:0x7ff015c26540 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x600003c84fa0 UILabel:0x7ff015e24660'Add photos with faces to ...'.leading >= UILayoutGuide:0x6000026bc000'UIViewLayoutMarginsGuide'.leading (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.