I upgraded XCode 5 to 6 to test my projects out on the iPhone 6 and 6 Plus and was getting cryptic crashes on startup:
'*** -[__NSArrayM objectAtIndex:]: index 4 beyond bounds [0 .. 3]'
*** First throw call stack:
(
0 CoreFoundation 0x000000010569b3f5 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000104b20bb7 objc_exception_throw + 45
2 CoreFoundation 0x00000001055864d3 -[__NSArrayM objectAtIndex:] + 227
3 UIKit 0x00000001028164e1 _UIViewTopDownSubtreeTraversal + 193
4 UIKit 0x0000000102e43286 -[UIView(UIConstraintBasedLayout_EngineDelegate) _invalidateSystemLayoutSizeFittingSizeAtEngineDelegateLevel] + 128
5 Foundation 0x0000000103aa66df -[NSISEngine tryToAddConstraintWithMarker:expression:integralizationAdjustment:mutuallyExclusiveConstraints:] + 915
6 Foundation 0x0000000103c2f678 -[NSLayoutConstraint _addLoweredExpression:toEngine:integralizationAdjustment:lastLoweredConstantWasRounded:mutuallyExclusiveConstraints:] + 275
7 Foundation 0x0000000103a9ae3a -[NSLayoutConstraint _addToEngine:integralizationAdjustment:mutuallyExclusiveConstraints:] + 220
8 UIKit 0x0000000102e40495 __57-[UIView(AdditionalLayoutSupport) _switchToLayoutEngine:]_block_invoke_2 + 474
9 Foundation 0x0000000103aa8a8e -[NSISEngine withBehaviors:performModifications:] + 155
10 UIKit 0x0000000102e4029b __57-[UIView(AdditionalLayoutSupport)
After a LOT of trial and error and trying various XIBs in various configurations, the issue occurred because I was mixing some XIBs with Auto Layout turned on, containing other UIViews (based on XIBs) with AutoLayout off.
Turning AutoLayout off for all of my XIBs solved the issue.