iPhone XCode UITabBarController和UINavigationController

Cou*_*son 1 iphone uinavigationcontroller ios

当我收到以下错误时,我正在尝试更新我的应用程序以在iPhone 5上工作:

Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency',
reason: 'A view can only be associated with at most one view controller at a time!
View <UITableView: 0x88fbe00; frame = (0 20; 320 548); clipsToBounds = YES; opaque = NO; 
autoresize = W+H; gestureRecognizers = <NSArray: 0x8395940>; layer = <CALayer: 0x8395350>;
contentOffset: {0, 0}> is associated with <UIViewController: 0x83967d0>. Clear this
association before associating this view with <UIViewController: 0x8381220>.'
Run Code Online (Sandbox Code Playgroud)

我正在运行XCode版本4.5,这从未发生过.我试图按照这个问题中的步骤进行操作.这就是我的MainWindow.xib的样子:

的MainWindow.xib

我做错了什么,我该如何解决?

PGr*_*ham 6

找到我的解决方案.打开视图的XIB文件,该文件应在加载时导致异常.确保对象列表顶部没有ViewController对象,其下方有View.如果有,请移动View,它将移动它下面的所有内容,移出与ViewController对象相同的级别.现在删除ViewController对象并确保您的XIB类正确设置到ViewController类,并希望它可以工作.


我有同样的问题.Xcode 4.5在iOS6(设备或模拟器)上构建和运行我遇到了这个问题.在<iOS6上运行应用程序的Xcode 4.5很好.在iOS6上运行的Xcode <4.5 AND构建的代码完全相同.所以它似乎是一个Xcode 4.5和iOS6组合.我不知道是什么导致了它.