AutoLayout, Unable to simultaneously satisfy constraints

The easiest way how to find unsatisfiable constraints:

  • set unique identifier for every constraint in your view:

enter image description here

  • create simple extension for NSLayoutConstraint:

SWIFT:

extension NSLayoutConstraint {

    override public var description: String {
        let id = identifier ?? ""
        return "id: \(id), constant: \(constant)" //you may print whatever you want here
    }
}

OBJECTIVE-C

@interface NSLayoutConstraint (Description)

@end

@implementation NSLayoutConstraint (Description)

-(NSString *)description {
    return [NSString stringWithFormat:@"id: %@, constant: %f", self.identifier, self.constant];
}

@end
  • build it once again, and now you have more readable output for you:

enter image description here

  • once you got your id you can simple tap it in your Find Navigator:

enter image description here

  • and quickly find it:

enter image description here

HOW TO SIMPLE FIX THAT CASE?

  • try to change priority to 999 for broken constraint.

See the related answer here: Unable to simultaneously satisfy constraints, will attempt to recover by breaking constraint

Leave a Comment