I'm updating an existing app to autolayout to support more device sizes. I have a few objects which need to animate and instead of working with constrains I set them to:
self.secondCounter.translatesAutoresizingMaskIntoConstraints = YES //example
to use the old setFrame methods.
This seems to work but throws an runtime error on first animation:
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) ( "", "", "" )
Will attempt to recover by breaking constraint
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in may also be helpful. 2014-10-07 19:41:12.903 AppName[5018:1153922] 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) ( "", "", "" )
Will attempt to recover by breaking constraint
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in may also be helpful.
In fact I don't get this message because I don't set any constrains on this object (I heard Xcode sets them per default on build for every view in an auto layout xib).
But somehow everything looks good and seems to work.
Can I just ignore this message or will I run into problems later?
You will definitely run into problems later and need to resolve this. If you don't satisfy all your constraints and the runtime correction system can't 'fudge the numbers', it can cause your app to crash. You can get nasty messages like this one:
Fatal Exception: NSInvalidArgumentException. Unable to create description in descriptionForLayoutAttribute_layoutItem_coefficient. Something is nil
In order to solve autolayout issues, follow some simple steps:
(source: apple.com)
That's it! Find, fix, test :)