Summary:
Adding the launch argument -UIViewShowAlignmentRects YES to debug alignment rectangles causes a crash if there is a UIViewEffectView in the view hierarchy. This happens for example with a plain UIViewController embedded in a navigation controller.
Steps to Reproduce:
Create a new Xcode project using the single view app template.
Modify the storyboard to embed the view controller in a navigation controller.
Edit the scheme to add and enable the following launch argument to the run action:
-UIViewShowAlignmentRects YES
Build and run on a simulator
Expected Results:
The alignment rectangles of the views are displayed in yellow.
Actual Results:
Crashes with following console message:
2017-10-17 16:46:24.425431+0100 Alignment[24633:2704672] [LayoutConstraints] UIViewShowAlignmentRects is ON
2017-10-17 16:46:24.505213+0100 Alignment[24633:2704672] Assertion failure in -[UIVisualEffectView _addSubview:positioned:relativeTo:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3698.16.15/UIVisualEffectView.m:1464
2017-10-17 16:46:24.512331+0100 Alignment[24633:2704672] Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: ' > has been added as a subview to >. Do not add subviews directly to the visual effect view itself, instead add them to the -contentView.'
Version/Build:
iOS 11.0.1 (15A8401)
Xcode Version 9.0.1 (9A1004)
Description
Area: UIKit
Summary: Adding the launch argument -UIViewShowAlignmentRects YES to debug alignment rectangles causes a crash if there is a UIViewEffectView in the view hierarchy. This happens for example with a plain
UIViewController
embedded in a navigation controller.Steps to Reproduce:
Expected Results:
The alignment rectangles of the views are displayed in yellow.
Actual Results:
Crashes with following console message:
2017-10-17 16:46:24.425431+0100 Alignment[24633:2704672] [LayoutConstraints] UIViewShowAlignmentRects is ON 2017-10-17 16:46:24.505213+0100 Alignment[24633:2704672] Assertion failure in -[UIVisualEffectView _addSubview:positioned:relativeTo:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3698.16.15/UIVisualEffectView.m:1464 2017-10-17 16:46:24.512331+0100 Alignment[24633:2704672] Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: ' > has been added as a subview to >. Do not add subviews directly to the visual effect view itself, instead add them to the -contentView.'
Version/Build: iOS 11.0.1 (15A8401) Xcode Version 9.0.1 (9A1004)
- Product Version: 9.0.1 Created: 2017-10-17T16:03:24.745830 Originated: 2017-10-17T00:00:00 Open Radar Link: http://www.openradar.me/35029997