简体   繁体   中英

Unable to simultaneously satisfy constraints runtime error in Swift

I get this error in runtime for my ios(UIKit) application. It is coming from UITableView . The app runs without constraint errors and with the expected behavior.

I've seen other questions regarding the same error but should I leave this error as it is?

The error is partially complaining about my two UITableView which are connected through a cell(First table uses 1.6 as the aspect ratio and second view uses .55 for width/size). I'm not sure how this can be fixed since there is no problem and these views are separate.

[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:0x600001575860 UIImageView:0x7f8795f474f0.width == 1.6*UIImageView:0x7f8795f474f0.height   (active)>",
    "<NSLayoutConstraint:0x600001575770 V:|-(10)-[UIStackView:0x7f8795f47080]   (active, names: '|':UITableViewCellContentView:0x7f8795f46b50 )>",
    "<NSLayoutConstraint:0x600001575810 V:[UIStackView:0x7f8795f47080]-(10)-|   (active, names: '|':UITableViewCellContentView:0x7f8795f46b50 )>",
    "<NSLayoutConstraint:0x600001575950 UIImageView:0x7f8795f474f0.width == 0.55*UITableViewCellContentView:0x7f8795f46b50.width   (active)>",
    "<NSLayoutConstraint:0x600001573f20 'UISV-alignment' UILabel:0x7f8795f47210.bottom == UIImageView:0x7f8795f474f0.bottom   (active)>",
    "<NSLayoutConstraint:0x600001575ae0 'UISV-alignment' UILabel:0x7f8795f47210.top == UIImageView:0x7f8795f474f0.top   (active)>",
    "<NSLayoutConstraint:0x60000150cdc0 'UISV-canvas-connection' UIStackView:0x7f8795f47080.top == UILabel:0x7f8795f47210.top   (active)>",
    "<NSLayoutConstraint:0x60000150ce60 'UISV-canvas-connection' V:[UILabel:0x7f8795f47210]-(0)-|   (active, names: '|':UIStackView:0x7f8795f47080 )>",
    "<NSLayoutConstraint:0x600001575cc0 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7f8795f46b50.height == 154.333   (active)>",
    "<NSLayoutConstraint:0x600001575c70 'UIView-Encapsulated-Layout-Width' UITableViewCellContentView:0x7f8795f46b50.width == 390   (active)>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x600001575860 UIImageView:0x7f8795f474f0.width == 1.6*UIImageView:0x7f8795f474f0.height   (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.

It seems you're setting constraints to the same view twice:

"<NSLayoutConstraint:0x600001575860 UIImageView:0x7f8795f474f0.width == 1.6*UIImageView:0x7f8795f474f0.height (active)>",

"<NSLayoutConstraint:0x600001575950 UIImageView:0x7f8795f474f0.width == 0.55*UITableViewCellContentView:0x7f8795f46b50.width (active)>"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM