It just happens sometimes. The UI responds to a button touch, but then it just freezes. Nothings happens in the UI. CPU runs with maximum speed and the amount of used memory increases constantly.
Our code is in an infinite loop and we’ll need to find out why. There is a handy launch argument that will help us to debug the situation in iOS and macOS environments.
We can give a value between 50 and 1000 to this argument. Debugger counts subview run loops and if any subview goes over the set value, debugger collects information and then dumps the log.
The log clearly shows ambiguous layouts. The ambiguous layout is contagious phenomenon. If one view is missing a constraint or a two then also other views that are depending on that view become ambiguous.
We can also set an exception breakpoint for the feedback loop:
po [_UIViewLayoutFeedbackLoopDebuggingThreshold layoutFeedbackLoopDebugger]