自动布局报错(两条连线冲突):Unable to simultaneously satisfy constraints

本文介绍了一种常见的iOS开发中遇到的问题——布局约束冲突,并提供了解决方案。当出现无法同时满足约束的情况时,可以通过检查并移除重复的边距约束来解决问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 这个报错有些长:

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:0x600000096580 H:[UIButton:0x7fc8eb408a50'Button']-(2)-|   (active, names: '|':UIView:0x7fc8eb40d330 )>",
    "<NSLayoutConstraint:0x600000096670 H:[UIButton:0x7fc8eb408a50'Button']-(3)-|   (active, names: '|':UIView:0x7fc8eb40d330 )>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x600000096670 H:[UIButton:0x7fc8eb408a50'Button']-(3)-|   (active, names: '|':UIView:0x7fc8eb40d330 )>

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.

 

我的报错原因: 就是同意的边距连了两条线(2 conflicting constrains);

                   

                   点击 黄色的警告(⚠️),找到冲突的线,检查,很容易找到问题。

 

        之前好像是直接显示红色报错的,now是 黄色警告?

转载于:https://www.cnblogs.com/code-Officer/p/6258669.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值