屏蔽烦人的Masonry约束警告控制台输出

在使用Masonry布局框架时,有时候因为使用不当会导致约束冲突,会在控制台输出类似这样的警告

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.
2019-03-12 23:11:35.844573+0800 artDesign[11723:4004040] [LayoutConstraints] 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. 
(
    "",
    "",
    "",
    "",
    "",
    ""
)

Will attempt to recover by breaking constraint 

这类输出很烦,少的话可以设置约束优先级来解决,多的话不想解决怎办?
在网上找到了这个方法http://landcareweb.com/questions/7235/zai-xcodede-diao-shi-kong-zhi-tai-shu-chu-zhong-jin-yong-zi-dong-bu-ju-yue-shu-cuo-wu-xiao-xi

Swift 3

 UserDefaults.standard.setValue(false, forKey: "_UIConstraintBasedLayoutLogUnsatisfiable")

Objective-C

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

可以设置该参数达到屏蔽的目的,不过警告能解决就解决吧。

你可能感兴趣的:(屏蔽烦人的Masonry约束警告控制台输出)