Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autolayout constraints warning “Will attempt to recover by breaking constraint”

I am trying to implement a feed of news (somehow like instagram without comments or likes). It works, but xcode keep showing this error. I tried change all the constraints, however, I cant get to work. The tableview has a height of 475 and the image has the height of 400, leaving 75 for the white area with labels.

I did use

self.tableView.estimatedRowHeight = 475;
self.tableView.rowHeight = UITableViewAutomaticDimension;

Any help?

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) 
(

    "<NSLayoutConstraint:0x174096530 UIImageView:0x1743e9000.top == UITableViewCellContentView:0x17418af80.topMargin + 13>",
    "<NSLayoutConstraint:0x1740977f0 V:[PFImageView:0x1743e8e00]-(0)-|   (Names: '|':UITableViewCellContentView:0x17418af80 )>",
    "<NSLayoutConstraint:0x174097840 V:[UIImageView:0x1743e9000]-(24)-[PFImageView:0x1743e8e00]>",
    "<NSLayoutConstraint:0x174097890 H:|-(0)-[PFImageView:0x1743e8e00]   (Names: '|':UITableViewCellContentView:0x17418af80 )>",
    "<NSLayoutConstraint:0x174097930 H:[PFImageView:0x1743e8e00]-(0)-|   (Names: '|':UITableViewCellContentView:0x17418af80 )>",
    "<NSLayoutConstraint:0x174097ac0 PFImageView:0x1743e8e00.width == PFImageView:0x1743e8e00.height>",
    "<NSLayoutConstraint:0x174097b60 V:[UIImageView:0x1743e9000(30)]>",
    "<NSLayoutConstraint:0x174092ed0 'UIView-Encapsulated-Layout-Width' H:[UITableViewCellContentView:0x17418af80(375)]>",
    "<NSLayoutConstraint:0x174092f20 'UIView-Encapsulated-Layout-Height' V:[UITableViewCellContentView:0x17418af80(44)]>"
)


Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x174097b60 V:[UIImageView:0x1743e9000(30)]>

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.
like image 620
cldev Avatar asked Feb 17 '15 22:02

cldev


1 Answers

I actually solved the problem changing the priority from the bottom of the image constrain to 750. Thanks for the help.

like image 163
cldev Avatar answered Sep 28 '22 18:09

cldev