且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

尝试呈现模态视图控制器时的UIViewControllerHierarchyInconsistency

更新时间:2023-02-16 11:24:39

在最新的Xcode版本中,我已经两次遇到过这种情况。
在这两种情况下我都需要对UIViewController的XIB文件进行更改(在这种情况下,它将是MapViewController.xib:

This happened to me already twice in the newest Xcode release. In both cases I needed to make changes to the UIViewController's XIB file (In you case it would be MapViewController.xib:

BEFORE:


  1. 将主视图移出查看控制器的子项

  2. 从XIB中移除查看控制器(由于文件的所有者已经是其类,因此没有必要):

  1. Move main View out of View Controller's children:
  2. Remove View Controller from the XIB (it is not necessary since File's Owner should be of its Class already):

之后: