1

I am trying to make a segue from a tableview into a UIViewController, but I'm getting a curious error. The error occurs even if the target view is completely empty, just added to the storyboard. My thought is some element of sending view is triggering the error, but I am confused why this is only showing when exiting that TableViewController, not when loading it initially.

This is the stack trace form the error:

Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2014-10-14 00:52:23.472 Phood[54950:70b] 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:0x9d56270 H:[PHStarsView:0x9d9c4a0(70)]>",
    "<NSLayoutConstraint:0xf544940 H:|-(20)-[PHStarsView:0x9d9c4a0]   (Names: '|':UITableViewCellContentView:0x9fcd710 )>",
    "<NSLayoutConstraint:0xf543d90 H:[PHStarsView:0x9d9c4a0]-(80)-|   (Names: '|':UITableViewCellContentView:0x9fcd710 )>",
    "<NSAutoresizingMaskLayoutConstraint:0x9d774e0 h=--& v=--& H:[UITableViewCellContentView:0x9fcd710(320)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x9d56270 H:[PHStarsView:0x9d9c4a0(70)]>
1
  • 1
    You have a NSAutoresizingMaskLayoutConstraint conflict. Those auto-sizing constraints tend to conflict with regular constraints. Be sure that the UITableViewCell.contentView.subviews are all subview.setTranslatesAutoresizingMaskIntoConstraints(false), if added programmatically. Dec 6, 2014 at 5:12

2 Answers 2

3

I ran into the same problem with a custom UITableViewCell nib. Something about deallocating the cell breaks constraints.

Try adding

- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return UITableViewAutomaticDimension;
}
1
  • This fixed it for me. Must be a bug in auto-layout. Dec 6, 2014 at 5:22
0

You are adding constraints to your views and yet you have translatesAutoresizingMaskIntoConstraints set to YES on your cell's contentView. Set that to NO--you obviously want to be in control of your constraints and not use iOS's defaults.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.