Getting the Most out of WTF Auto Layout

by Lou Franco

Filed under: iOS and Auto Layout and Constraints

The next time you see the dreaded:

Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want

take a look at WTF Auto Layout.

It parses the list of constraints that Xcode dumps into the console and gives you a visual representation of what your ambiguous constraints are trying to do.

But WTF Auto Layout can only label the views with however Xcode decided to label them, which is just their typename by default, so you might end up with something like this:

In a simple view, this might be enough to help you, but you probably don’t need WTF Auto Layout for your simple problems. With just typenames, this isn’t going to help much.

Luckily, Xcode will use other cues from your view to pick up names. Here are other places Xcode will try to get labels for this error message:

  1. The text in views that show text (like UILabel and UIButton).
  2. The names of IBOutlet properties
  3. The Xcode Specific Label in the Document section of the Identity Inspector in Interface Builder.
  4. The constraint’s identifer property.

So, if you get an error that you are having a hard time understanding, start filling in constraint identifiers and Xcode labels to help WTF Auto Layout give you something more you can work with.

Never miss a post

Get more tips like this in your inbox