Unable to simultaneously satisfy constraints.

在进行版本的迭代更新时,新功能需求需要对主页面的UI进行重新的布局,但是,报了错误,出了好多约束方面的问题:

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:0x8c67c10 V:[UIButton:0x8c67320]-(2)-|   (Names: '|':UIView:0x8c65ad0 )>",

    "<NSAutoresizingMaskLayoutConstraint:0x8e166b0 h=--& v=--& UIButton:0x8c67320.midY ==>",

    "<NSAutoresizingMaskLayoutConstraint:0x8e166e0 h=--& v=--& V:[UIButton:0x8c67320(0)]>",

    "<NSAutoresizingMaskLayoutConstraint:0x8e130d0 h=-&- v=-&- UIView:0x8c65ad0.height == PicCollectionViewCell:0x8c65a00.height>",

    "<NSLayoutConstraint:0x8e13710 'UIView-Encapsulated-Layout-Height' V:[PicCollectionViewCell:0x8c65a00(100)]>"

)

Will attempt to recover by breaking constraint 

<NSLayoutConstraint:0x8c67c10 V:[UIButton:0x8c67320]-(2)-|   (Names: '|':UIView:0x8c65ad0 )>

Break on objc_exception_throw to catch this in the debugger.

The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.

 

总的来说,出现这样的问题,有可能是本身的约束问题,当然也可能是忘记设置属性

self.automaticallyAdjustsScrollViewInsets = NO(也可能不需要);同时在iOS9下,我们主界面更新UI需要放到主线程中来进行操作,如果不确定,可以打印下当前的线程来确定:

dispatch_async(dispatch_get_main_queue(), ^{

//更新UI

});

如果界面涉及到js交互回调传值的情况(ios 9下),同样需要我们把回传数据等操作放到主线程来操作。

上一篇:Intellij Idea上Spring Boot编译报错:Error:(3, 32) java: 程序包org.springframework.boot不存在


下一篇:can't run roscore 并且 sudo 指令返回 unable to resolve host