My application starts with the main menu, which is a subclass of the UIViewController called LVSMainViewController . It is built into the UINavigationController , which is set as the initial VC in the storyboard. LVSMainViewController implements -viewDidLayoutSubviews .
Pressing the button leads the user to another section of the application (another VC). The user returns to the main menu with the button connected to the press. But when the application loads the VC main menu again, it crashes with the message:
2014-08-28 16: 11: 14.122 * Approval error in - [UIView layoutSublayersOfLayer:], / SourceCache / UIKit_Sim / UIKit-2935.137 / UIView.m: 8803
2014-08-28 16: 11: 14.257 * Application termination due to the uncaught exception "NSInternalInconsistencyException", reason: "Auto-linking is still required after sending -viewDidLayoutSubviews to the view controller. The LVSMainViewController implementation must send -layoutSubviews to the view to call automatic layout. '
Other posts in SO report the same error when programming automatic layout restrictions (I do not, although I use automatic layout in the storyboard) and / or when using UITableView (which I do not use either in the VC main menu or in VC, to to which it goes, although I use it elsewhere in the application). (See here or here .)
Other puzzle pieces:
I tried adding [self.view layoutSubviews]; at the end is -viewDidLayoutSubviews . When I do this, it does not fall. But it seems like this is bad, as Apple's documentation says
You should not call this method directly. If you want layout updates, call the setNeedsLayout method instead to do this earlier for the next drawing update.
If I add [self.view setNeedsLayout]; at the end -viewDidLayoutSubviews , the application crashes with it first loads the VC main menu, and not when I leave it and return it.
What could be the reason for this?
source share