但是当我运行这个演示时,有一个例外:
2015-07-22 21:54:41.697 Test[3884:2992098] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/zhanggui/Library/Developer/CoreSimulator/Devices/DEBA893C-5DF5-4A9A-AAAD-D992CAED1185/data/Containers/Bundle/Application/DA15E304-CD75-4739-9AF9-2B930CA84EFF/Test.app> (loaded)' with name 'TIt-bJ-Hqi-view-AtR-6S-RDw''
*** First throw call stack:
(
0 CoreFoundation 0x02047746 __exceptionPreprocess + 182
1 libobjc.A.dylib 0x00531a97 objc_exception_throw + 44
2 CoreFoundation 0x0204766d +[NSException raise:format:] + 141
3 UIKit 0x00ab9ddf -[UINib instantiateWithOwner:options:] + 1003
4 UIKit 0x008d40d4 -[UIViewController _loadViewFromNibNamed:bundle:] + 270
5 UIKit 0x008d486b -[UIViewController loadView] + 295
6 UIKit 0x008d4a9f -[UIViewController loadViewIfRequired] + 78
7 UIKit 0x008d5045 -[UIViewController view] + 35
8 UIKit 0x00924cdf -[UITabBarController transitionFromViewController:toViewController:transition:shouldSetSelected:] + 426
9 UIKit 0x0092431f -[UITabBarController transitionFromViewController:toViewController:] + 64
10 UIKit 0x009204db -[UITabBarController _setSelectedViewController:] + 339
11 UIKit 0x00920295 -[UITabBarController setSelectedIndex:] + 115
12 UIKit 0x0091fe41 __51-
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
如何解决?
答案 0 :(得分:0)
看起来问题不在于视图的布局,而在于如何呈现视图。这是因为“无法在捆绑中加载NIB:”。很可能是笔尖拼写错误,你从错误的捆绑中加载它,或者它不是你想要加载的NIB文件。