Raised if the view controller hierarchy is inconsistent with the view hierarchy.
- iOS 5.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
When a view controller's view is added to the view hierarchy, the system walks up the view hierarchy to find the first parent view that has a view controller. That view controller must be the parent of the view controller whose view is being added. Otherwise, this exception is raised. This consistency check is also performed when a view controller is added as a child by calling the
It is also allowed for a view controller that has no parent to add its view to the view hierarchy. This is generally not recommended, but is useful in some special cases.