Disable autodetection restriction error messages on debug console output in Xcode

Is there a way (temporarily) to disable the auto-sensing / warning error message:

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) ( "<NSLayoutConstraint:0x170098420 H:[UIView:0x15c62c100(2)]>", "<NSLayoutConstraint:0x170098600 UIView:0x15c6294f0.leading == UIView:0x15c628d40.leadingMargin - 8>", "<NSLayoutConstraint:0x170098650 H:[UIView:0x15c6294f0]-(0)-[UIView:0x15c62b750]>", "<NSLayoutConstraint:0x1700986a0 UIView:0x15c62b750.width == UIView:0x15c6294f0.width>", "<NSLayoutConstraint:0x1700986f0 UIView:0x15c628d40.trailingMargin == UIView:0x15c62b750.trailing - 8>", "<NSLayoutConstraint:0x170098880 H:[UIView:0x15c6294f0]-(0)-[UIView:0x15c62c100]>", "<NSLayoutConstraint:0x1700988d0 UIView:0x15c628d40.centerX == UIView:0x15c62c100.centerX + 1>" ) Will attempt to recover by breaking constraint <NSLayoutConstraint:0x170098420 H:[UIView:0x15c62c100(2)]> Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful. 
+42
ios xcode autolayout
Jul 6 '15 at 7:24
source share
4 answers

Decompilation has occurred and actually a way:

Swift

 NSUserDefaults.standardUserDefaults().setValue(false, forKey: "_UIConstraintBasedLayoutLogUnsatisfiable") 

Objective-c

 [[NSUserDefaults standardUserDefaults] setValue:@(NO) forKey:@"_UIConstraintBasedLayoutLogUnsatisfiable"]; 

Now you will receive a notification only that "_UIConstraintBasedLayoutLogUnsatisfiable is OFF".

A compulsory reminder for everyone who reads this: this should be the last thing, see the WWDC sections "Secrets of automatic layout" for tips on debugging and removing restrictions: part 1 and part 2 .

+102
Sep 23 '15 at 16:49
source share

Swift 3.0 solution:

 //Hide Autolayout Warning UserDefaults.standard.setValue(false, forKey:"_UIConstraintBasedLayoutLogUnsatisfiable") 
+10
Dec 23 '16 at 2:00
source share

I tried to solve this with lldb and I found a solution:

  • Create a symbolic breakpoint for the UIViewAlertForUnsatisfiableConstraints symbol in the UIKit module.
  • Add a return flow debugger command as a breakpoint action
  • Add a second debugger command: "c"
  • Disable "Continue automatically after evaluating actions"

If your application encounters a layout problem, execution is paused. With the "return stream" instruction, the UIViewAlertForUnsatisfiableConstraints function, which displays this error, is forced to return before a warning message is printed to the console.

With the c command, your application continues to run (Note: "Automatically continue after evaluating actions" somehow does not work in this case)

However, with these automatic actions, the breakpoint is likely to behave strangely if it hits twice in a row, which will cause your application to crash. To solve this problem, you can remove the breakpoint actions and enter the commands manually when the debugger pauses the program.

+3
Sep 08 '15 at 4:12
source share

for those who wonder how to do macOS / osx with AppKit / Cocoa

 UserDefaults.standard.set(false, forKey: "NSConstraintBasedLayoutLogUnsatisfiable") UserDefaults.standard.set(false, forKey: "__NSConstraintBasedLayoutLogUnsatisfiable") 
+1
Aug 01 '17 at 19:26
source share



All Articles