Search code examples
ios7ios8autolayoutnslayoutconstraintiboutlet

Constraint constant is nil iOS 7 but not in iOS 8


I have 3 outlets that change constant variables in 3 views, and can't seem to understand why this happens. NOTE: THIS HAS NOTHING TO WITH THE INTERFACE (so no setneedlayout or layoutifneeded answers). I get it.

// iOS 7
_fillerConstraint.constant = 200;
NSLog(@"_fillerConstraint: %f", _fillerConstraint.constant);

2015-02-15 08:55:14.54 Hurricane[44367:613] _fillerConstraint: 0.000000

// iOS 8
 _fillerConstraint.constant = 200;
NSLog(@"_fillerConstraint: %f", _fillerConstraint.constant);

2015-02-15 08:55:14.547 Hurricane[44367:613] _fillerConstraint: 200.000000

A method is called from viewwillappear to set these values and do some animation. All is well in iOS 8 and works as expected. However in iOS7 the debugger is reporting the constraint is nil. Anyone know what might cause this behavior?


Solution

  • After cleaning the app and resetting the simulators. It works fine. The answer to issues like this is, Xcode 6 is full of bugs.