4

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...

Goutallier
  • 192
  • 1
  • 8

1 Answers1

8

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

IB constraint settings

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

IB constraint settings

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...

Goutallier
  • 192
  • 1
  • 8
  • As of today (feb 2017) this seems to be a problem with iOS8. I had a Standard constant that failed on both device (iOS 8.4) and simulator (iOS 8.2). Changing the constant to 0 fixed it. The bug was not present on iOS 9. – wyu Feb 22 '17 at 02:28