我的应用程序在iOS5中正常运行但是当我切换到iOS6时,由于UIViewControllerHierarchyInconsistency而崩溃了。
错误如下所示:
UIViewControllerHierarchyInconsistency', reason: 'A view can only be associated with at most one view controller at a time! View <UILayoutContainerView: 0xa148de0; frame = (0 0; 320 480); autoresize = W+H; layer = <CALayer: 0xa148ea0>> is associated with <UITabBarController: 0xa64af30>. Clear this association before associating this view with <lkViewController: 0xa33faa0>.'
我已经查看了stackoverflow上的一些解决方案,它告诉我删除viewcontrollers。但是当我删除tabbarcontroller时,视图显示不正确。
我的xib文件如下所示:
需要一些指导......谢谢......
编辑:
崩溃来自lkViewController中的这一行:
self.view = m_tabBarController.view;
当m_tabBarController是UITabBarController时。
答案 0 :(得分:1)
更改
self.view = m_tabBarController.view;
到
[self.view addSubview:m_tabBarController.view];
将解决问题...