IB allows constraints on visual effect view that runtime warns about

Originator:skagedal
Number:rdar://41159623 Date Originated:15-Jun-2018 04:51 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 9.4 (9F1027a) on macOS 10.13.5 (17F77)
Classification:Security Reproducible:Always
 
Summary:
If a label is put in the content view of a UIVisualEffectView in a nib or storyboard, and constraints are added from the label to the UIVisualEffectView, Interface Builder will be happy and there are no warnings – but when running, warnings show.


Steps to Reproduce:
Run the attached project, also at https://github.com/skagedal/radars/tree/master/constraints-against-visual-effect-view

Expected Results:
Either: 
 - Interface Builder does not allow this or shows a warning. 

Or:
 - Runtime does not give warnings.

Actual Results:
Following output in console:

2018-06-15 16:44:59.789440+0200 ConstraintsAgainstVisualEffectView[31128:347952] [LayoutConstraints] The view hierarchy is not prepared for the constraint: <NSLayoutConstraint:0x6040000994b0 UILabel:0x7fc8ece048e0'Here's a label'.leading == UIVisualEffectView:0x7fc8ece04680.leading + 16   (inactive)>
	When added to a view, the constraint's items must be descendants of that view (or the view itself). This will crash if the constraint needs to be resolved before the view hierarchy is assembled. Break on -[UIView(UIConstraintBasedLayout) _viewHierarchyUnpreparedForConstraint:] to debug.
2018-06-15 16:44:59.789647+0200 ConstraintsAgainstVisualEffectView[31128:347952] [LayoutConstraints] The view hierarchy is not prepared for the constraint: <NSLayoutConstraint:0x60400009b800 UIVisualEffectView:0x7fc8ece04680.bottom == UILabel:0x7fc8ece048e0'Here's a label'.bottom + 16   (inactive)>
	When added to a view, the constraint's items must be descendants of that view (or the view itself). This will crash if the constraint needs to be resolved before the view hierarchy is assembled. Break on -[UIView(UIConstraintBasedLayout) _viewHierarchyUnpreparedForConstraint:] to debug.
2018-06-15 16:44:59.789789+0200 ConstraintsAgainstVisualEffectView[31128:347952] [LayoutConstraints] The view hierarchy is not prepared for the constraint: <NSLayoutConstraint:0x60400009b8f0 UIVisualEffectView:0x7fc8ece04680.trailing == UILabel:0x7fc8ece048e0'Here's a label'.trailing + 16   (inactive)>
	When added to a view, the constraint's items must be descendants of that view (or the view itself). This will crash if the constraint needs to be resolved before the view hierarchy is assembled. Break on -[UIView(UIConstraintBasedLayout) _viewHierarchyUnpreparedForConstraint:] to debug.
2018-06-15 16:44:59.789977+0200 ConstraintsAgainstVisualEffectView[31128:347952] [LayoutConstraints] The view hierarchy is not prepared for the constraint: <NSLayoutConstraint:0x60400009b940 UILabel:0x7fc8ece048e0'Here's a label'.top == UIVisualEffectView:0x7fc8ece04680.top + 16   (inactive)>
	When added to a view, the constraint's items must be descendants of that view (or the view itself). This will crash if the constraint needs to be resolved before the view hierarchy is assembled. Break on -[UIView(UIConstraintBasedLayout) _viewHierarchyUnpreparedForConstraint:] to debug.


Version:
Xcode 9.4 (9F1027a) on macOS 10.13.5 (17F77)

Notes:
If you instead put the constraints against the content view, no warnings appear.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!