修改XIB文件后应用程序崩溃

时间:2011-07-17 09:23:38

标签: iphone interface-builder crash uisearchbar xib

在RootViewController.xib上添加新的搜索栏并将其与FileOwner连接后,应用程序将崩溃。它在崩溃时报告堆栈:

2011-07-17 17:12:43.756 TableView[1397:207] *** Terminating app due to uncaught 
exception 'NSInternalInconsistencyException', reason: '-[UIViewController 
_loadViewFromNibNamed:bundle:] loaded the "RootViewController" nib but the view outlet 
 was not set.'
 *** Call stack at first throw:
 (
0   CoreFoundation                      0x00dc85a9 __exceptionPreprocess + 185

1   libobjc.A.dylib                     0x00f1c313 objc_exception_throw + 44

2   CoreFoundation                      0x00d80ef8 +[NSException raise:format:arguments:] + 136

3   CoreFoundation                      0x00d80e6a +[NSException raise:format:] + 58

4   UIKit                               0x0036a709 -[UIViewController _loadViewFromNibNamed:bundle:] + 295

5   UIKit                               0x00368134 -[UIViewController loadView] + 120

6   UIKit                               0x004c1dd8 -[UITableViewController loadView] + 80

7   UIKit                               0x0036800e -[UIViewController view] + 56

8   UIKit                               0x003667f5 -[UIViewController nextResponder] + 34

9   UIKit                               0x003874a6 -[UIResponder _containsResponder:] + 41

10  UIKit                               0x00371c4e -[UINavigationController defaultFirstResponder] + 80

11  UIKit                               0x00386647 -[UIResponder(Internal) _deepestDefaultFirstResponder] + 42

12  UIKit                               0x00386663 -[UIResponder(Internal) _deepestDefaultFirstResponder] + 70

13  UIKit                               0x00386406 -[UIResponder(Internal) _promoteDeepestDefaultFirstResponder] + 42

14  TableView                           0x00002a0a -[TableViewAppDelegate application:didFinishLaunchingWithOptions:] + 135

15  UIKit                               0x002b8c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163

16  UIKit                               0x002bad88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439

17  UIKit                               0x002c5617 -[UIApplication handleEvent:withNewEvent:] + 1533

18  UIKit                               0x002bdabf -[UIApplication sendEvent:] + 71

19  UIKit                               0x002c2f2e _UIApplicationHandleEvent + 7576

20  GraphicsServices                    0x01720992 PurpleEventCallback + 1550

21  CoreFoundation                      0x00da9944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52

22  CoreFoundation                      0x00d09cf7 __CFRunLoopDoSource1 + 215

23  CoreFoundation                      0x00d06f83 __CFRunLoopRun + 979

24  CoreFoundation                      0x00d06840 CFRunLoopRunSpecific + 208

25  CoreFoundation                      0x00d06761 CFRunLoopRunInMode + 97

26  UIKit                               0x002ba7d2 -[UIApplication _run] + 623

27  UIKit                               0x002c6c93 UIApplicationMain + 1160
28  TableView                           0x00002960 main + 102
29  TableView                           0x000028f1 start + 53
30  ???                                 0x00000001 0x0 + 1
 )

 terminate called after throwing an instance of 'NSException'

1 个答案:

答案 0 :(得分:2)

好吧,我不知道你希望我们告诉你什么,然后你的错误已经告诉你了。

  

由于未捕获的异常而终止应用   'NSInternalInconsistencyException',原因:' - [UIViewController   _loadViewFromNibNamed:bundle:]加载了“RootViewController”nib 但是   视图插座未设置。'

那就是您忘记连接RootViewController的视图插座,因此它不知道要加载什么。 MainWindow的RootViewController是第一个要加载的东西,如果它不知道它应该显示什么视图,它会给你上面的错误。