【发布时间】:2017-11-06 02:07:48
【问题描述】:
我是 iOS 开发的新手。我正在创建一个带有自动布局的聊天应用程序,但是每当我在我的应用程序中打开 collectionview 时,我都会“打破约束”。 这是我得到的错误
2017-11-06 07:34:52.838630+0530 ChatHub[4083:306096] [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:0x6040002989c0 BubbleView.width == 205.938 (active, names: BubbleView:0x7ffde3611880 )>",
"<NSLayoutConstraint:0x604000298600 ProfileImageView.width == 32 (active, names: ProfileImageView:0x7ffde3611a60 )>",
"<NSLayoutConstraint:0x60400028d890 H:|-(8)-[ProfileImageView](LTR) (active, names: ProfileImageView:0x7ffde3611a60, '|':ChatHub.ChatMessageCell:0x7ffde360e670 )>",
"<NSLayoutConstraint:0x6040002988d0 H:[ProfileImageView]-(8)-[BubbleView](LTR) (active, names: BubbleView:0x7ffde3611880, ProfileImageView:0x7ffde3611a60 )>",
"<NSLayoutConstraint:0x604000298880 BubbleView.right == ChatHub.ChatMessageCell:0x7ffde360e670.right - 8 (active, names: BubbleView:0x7ffde3611880 )>",
"<NSLayoutConstraint:0x6000004870d0 'UIView-Encapsulated-Layout-Width' ChatHub.ChatMessageCell:0x7ffde360e670.width == 375 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x6040002989c0 BubbleView.width == 205.938 (active, names: BubbleView:0x7ffde3611880 )>
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.
2017-11-06 07:34:53.041831+0530 ChatHub[4083:306096] [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:0x600000485c30 BubbleView.width == 205.938 (active, names: BubbleView:0x7ffde345dfb0 )>",
"<NSLayoutConstraint:0x600000485aa0 ProfileImageView.width == 32 (active, names: ProfileImageView:0x7ffde345e190 )>",
"<NSLayoutConstraint:0x600000485a00 H:|-(8)-[ProfileImageView](LTR) (active, names: ProfileImageView:0x7ffde345e190, '|':ChatHub.ChatMessageCell:0x7ffde345b380 )>",
"<NSLayoutConstraint:0x600000485b40 BubbleView.right == ChatHub.ChatMessageCell:0x7ffde345b380.right - 8 (active, names: BubbleView:0x7ffde345dfb0 )>",
"<NSLayoutConstraint:0x600000485b90 H:[ProfileImageView]-(8)-[BubbleView](LTR) (active, names: BubbleView:0x7ffde345dfb0, ProfileImageView:0x7ffde345e190 )>",
"<NSLayoutConstraint:0x60400029a810 'UIView-Encapsulated-Layout-Width' ChatHub.ChatMessageCell:0x7ffde345b380.width == 375 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x600000485c30 BubbleView.width == 205.938 (active, names: BubbleView:0x7ffde345dfb0 )>
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.
我该如何解决这个问题。我从过去两天被困在这里..请帮助
我在上面的截图中得到错误,但我没有在下面得到一个
【问题讨论】:
-
这个警告意味着列出的约束是互斥的;即至少其中一个与其他之一冲突。您将需要查看您的约束,找出哪些冲突,并修复这些。
-
我想弄清楚但没有运气!你能解释一下发生了什么吗!输出看起来像我想要的。但在控制台中出现此错误.. 我还能分享什么来获得答案。
-
在不了解您的具体布局的情况下很难确定问题。
标签: ios swift xcode autolayout