Centering subview’s X in autolayout throws “not prepared for the constraint” February 1, 2023 by Tarik For others who come here: I got this error, because I added the constraints before I added the subviews to the hierarchy.