简体   繁体   中英

Assertion failure in -[NSLayoutConstraint constant]

I got the following error after running my app on my iPhone:

Assertion failure in -[NSLayoutConstraint constant],  /SourceCache/Foundation/Foundation /Layout.subproj/NSLayoutConstraint.m:6432015-10-26 08:43:06.080 AuberML[195:6172] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '(null)'

The project was made on another computer, and it was working like a charm. If I remove all the constraints from my view (in IB), the app do not crash, but the elements are way out of place.

I developed the app using an iPhone 6, and now try to run it on an iPhone 5.

I guess I have to redo all my constraints in the meantime...

The problem was that IB sets the constant as "Standard":

IB约束设置

Under iOS >= 9.0.1, it is working fine. With iOS < 9, it needs to be explicitly set to 0.

IB约束设置

I have not yet tried with Xcode 7.1.

Hope that helps!

It apparently has to do with the following symbolic="YES" statement in the Main.storyboard constraint's definitions:

<constraint firstItem="inT-RM-poI" firstAttribute="top" secondItem="c5b-4a-YMr" secondAttribute="bottom" multiplier="1175:1920" symbolic="YES" id="jgh-yf-mvT"/>

By removing it, works fine...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM