Helo在xcode的调试器上,使用swift和swiftUI 5



HI

所以在对调试器进行了一些研究之后,我仍然不知道它是如何工作的:

2021-08-29 05:04:47.699766+0200 TestbaseThemed[7017:392999] [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:0x6000032c2b70 'BIB_Trailing_CB_Leading' H:[_UIModernBarButton:0x7f9861d13590]-(6)-[_UIModernBarButton:0x7f9861d10e60'Theme'd']   (active)>",
"<NSLayoutConstraint:0x6000032c2bc0 'CB_Trailing_Trailing' _UIModernBarButton:0x7f9861d10e60'Theme'd'.trailing <= _UIButtonBarButton:0x7f9861d10770.trailing   (active)>",
"<NSLayoutConstraint:0x6000032c39d0 'UINav_static_button_horiz_position' _UIModernBarButton:0x7f9861d13590.leading == UILayoutGuide:0x6000028e0b60'UIViewLayoutMarginsGuide'.leading   (active)>",
"<NSLayoutConstraint:0x6000032c3a20 'UINavItemContentGuide-leading' H:[_UIButtonBarButton:0x7f9861d10770]-(0)-[UILayoutGuide:0x6000028e0a80'UINavigationBarItemContentLayoutGuide']   (active)>",
"<NSLayoutConstraint:0x6000032c8eb0 'UINavItemContentGuide-trailing' UILayoutGuide:0x6000028e0a80'UINavigationBarItemContentLayoutGuide'.trailing == _UINavigationBarContentView:0x7f9863811270.trailing   (active)>",
"<NSLayoutConstraint:0x6000032c40a0 'UIView-Encapsulated-Layout-Width' _UINavigationBarContentView:0x7f9863811270.width == 0   (active)>",
"<NSLayoutConstraint:0x6000032c9270 'UIView-leftMargin-guide-constraint' H:|-(0)-[UILayoutGuide:0x6000028e0b60'UIViewLayoutMarginsGuide'](LTR)   (active, names: '|':_UINavigationBarContentView:0x7f9863811270 )>"
)
Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x6000032c2b70 'BIB_Trailing_CB_Leading' H:[_UIModernBarButton:0x7f9861d13590]-(6)-[_UIModernBarButton:0x7f9861d10e60'Theme'd']   (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.

我目前正在尝试调试,它有点破坏了我的程序。之前它没有造成任何问题,因为我没有在程序午餐前加载东西但现在,它给我带来了麻烦,因为一旦出现错误,函数就会停止工作,并且它不会加载它应该加载的的其余部分

我也考虑过在做其他事情之前等待func完成,但我不知道该怎么做所以我想我将不得不处理的调试

提前感谢您的回答!

(所以,幸运的是,我发现了错误,但我不知道为什么会这样:.navigationTitle("主题").navigationBarTitleDisplayMode(.lage))我很幸运

通常,其中一个约束不够灵活,无法帮助根据屏幕大小调整大小。

例如,如果您有一个宽度为200、左右边距为0的视图。这里,除非器件宽度为200,否则不能同时满足所有3个。

我提到的上述例子的解决方案是以下之一-

  1. 删除其中一个约束
  2. 将其中一个约束设置为大于/小于
  3. 降低其中一个约束的优先级

结果将是视图向左或向右移动并具有200宽度,或者其边距为0并具有灵活宽度。

最新更新