应用程序运行良好,直到我将 XCode 更新到 4.5 版和 iOS 6 SDK。
应用程序因以下输出而崩溃:
*** Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'A view can only be associated with at most one view controller at a time! View <UIView: 0xad397b0; frame = (0 20; 320 460); autoresize = W+H; layer = <CALayer: 0xad39810>> is associated with <UIViewController: 0xad39940>. Clear this association before associating this view with <RootViewController: 0x9e62f00>.'
*** First throw call stack:
(0xda012 0x1ea7e7e 0xd9deb 0xbc9309 0xc605ac 0xc5ca90 0x1661e8e 0x16619b7 0x168c428 0xd980cc 0x1ebb663 0xd545a 0xd96bcf 0xc5be37 0xc5c418 0xc5c648 0xc5c882 0xc5cb2a 0xc73ef5 0xc73fdb 0xc74286 0xc74381 0xc74eab 0xc74fc9 0xc75055 0xd7a3ab 0xbcb92d 0x1ebb6b0 0x405fc0 0x3fa33c 0x3fa150 0x3780bc 0x379227 0x41bb50 0xb9152f 0xa2afe 0xa2a3d 0x807c2 0x7ff44 0x7fe1b 0x2bef7e3 0x2bef668 0xb7b65c 0x2a6b 0x29d1)
libc++abi.dylib: terminate called throwing an exception
应用程序正在添加到窗口登录视图,然后是带有以下代码的标签栏视图:
/* LOGIN VIEW ADD */
[window addSubview:[loginVC view]];
[window makeKeyAndVisible];
/* LOGIN VIEW REMOVE AND ADD TAB BAR CONTROLLER */
[loginVC.view removeFromSuperview];
[window addSubview:[tabBarController view]];
[window makeKeyAndVisible];
应用程序在删除和添加后崩溃。
苹果在 iOS 6 上做了什么?为什么这会崩溃?