Final Update - Fixed
I have fixed this. It seems that while playing around (this is my first project in Swift and using AutoLayout) I have changed t
In my case this was because I was trying to layout (with autolayout) the subviews of a view that had a height == CGFLOAT_MAX.
Same code works well on iOS7 but crashes on iOS6.
Just putting this here in case anyone has the same issue with a dynamic, code-generated aspectRatio
constraint. I switched the order of the Height and Width relationship in the aspect-ratio constraint (compare to the one in the question):
aspectConstraint = NSLayoutConstraint(item: cardMedia, attribute: NSLayoutAttribute.Height , relatedBy: NSLayoutRelation.Equal, toItem: cardMedia, attribute: NSLayoutAttribute.Width, multiplier: aspect, constant: 0.0)
Where the multiplier aspect
is calculated by:
let aspect = image.size.height / image.size.width
And that seems to stop the crash from happening. Hope this helps someone.
It sounds like the original poster's problem is solved, but I just ran across a similar problem with a different solution. Posting it here in case anyone else runs into my issue and finds this post.
My app was crashing in iOS 7 on the iPhone 5s (in the simulator), but not on iOS 8 or on other devices. I was getting this same error ("Cannot find an outgoing row head for incoming head ...") when my controllers were being popped... and also when controllers were being scrolled away from in a UIPageViewController.
In both cases, the problem was triggered by the fact that I had full-screen views stacked on top of each other using APIs like UIView.insertSubview:belowSubview: and UIView.bringSubviewToFront: . The solution/workaround was to change our code to dynamically add/remove our views instead of stacking them and shuffling their order.
Hope this helps anyone else who hits the same problem.
I ran into a very similar crash myself. Interestingly, it was also with a UIImageView
. In my case, the problem was alleviated by changing the order of execution of (or removing) the code that adjusted the content compression resistance & content hugging priorities for this image view.
See more details in my answer here: https://stackoverflow.com/a/27284071/796419
Based on your situation, it seems that your 'aspect ratio' constraint was triggering a similar issue.
Ok. I've fixed it. It seems that I had somme of my constraints setup incorrectly. After taking a coffee break I figured out which ones and now the thing won't crash anymore.