2012-02-20 59 views
9

我正在使用Xcode 4,当我运行我的应用程序时,第一个屏幕不会加载。它在模拟器和设备上失败。我搜索了答案,他们都说要确保我已将文件所有者中的圈子拖到正确的视图。对不起,我不记得这些东西的名字,我是Xcode的新手。我把圈子拖到了正确的视角,并尝试了很多东西,但都没有奏效。我可能做错了什么?Xcode“ - [UIViewController _loadViewFromNibNamed:bundle:]加载了笔尖,但未设置视图插口。”错误

以下是完整的错误:

2012-02-19 12:59:54.655 Ponyboard[271:207] 
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', 
reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "PonyboardViewController" nib but the view outlet was not set.' 

*** Call stack at first throw: 
( 
    0 CoreFoundation      0x00f095a9 __exceptionPreprocess + 185 
    1 libobjc.A.dylib      0x0105d313 objc_exception_throw + 44 
    2 CoreFoundation      0x00ec1ef8 +[NSException raise:format:arguments:] + 136 
    3 CoreFoundation      0x00ec1e6a +[NSException raise:format:] + 58 
    4 UIKit        0x0020d709 -[UIViewController _loadViewFromNibNamed:bundle:] + 295 
    5 UIKit        0x0020b134 -[UIViewController loadView] + 120 
    6 UIKit        0x0020b00e -[UIViewController view] + 56 
    7 UIKit        0x0017ed42 -[UIWindow addRootViewControllerViewIfPossible] + 51 
    8 Ponyboard       0x00002a87 -[PonyboardAppDelegate application:didFinishLaunchingWithOptions:] + 135 
    9 UIKit        0x0015bc89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163 
    10 UIKit        0x0015dd88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439 
    11 UIKit        0x00168617 -[UIApplication handleEvent:withNewEvent:] + 1533 
    12 UIKit        0x00160abf -[UIApplication sendEvent:] + 71 
    13 UIKit        0x00165f2e _UIApplicationHandleEvent + 7576 
    14 GraphicsServices     0x031fd992 PurpleEventCallback + 1550 
    15 CoreFoundation      0x00eea944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52 
    16 CoreFoundation      0x00e4acf7 __CFRunLoopDoSource1 + 215 
    17 CoreFoundation      0x00e47f83 __CFRunLoopRun + 979 
    18 CoreFoundation      0x00e47840 CFRunLoopRunSpecific + 208 
    19 CoreFoundation      0x00e47761 CFRunLoopRunInMode + 97 
    20 UIKit        0x0015d7d2 -[UIApplication _run] + 623 
    21 UIKit        0x00169c93 UIApplicationMain + 1160 
    22 Ponyboard       0x000029c9 main + 121 
    23 Ponyboard       0x00002945 start + 53 
) 
terminate called after throwing an instance of 'NSException' 

回答

32

你确定你有一个UIView(或子类)分配给PonyboardViewController的“查看”属性?在PonyboardViewController的xib的左窗格中右键单击“文件所有者”,并确认“view”插口已设置。

如果不是,请将其设置为一个视图!

2

您的问题可能在于XIB或Stroyborad场景。检查视图是否正确连接到课程。

我已经尝试过了,并且在完成后对我来说工作正常。

3

我只是有同样的问题,因为你,所以我定会这样: 这是我的代码块:

self.chatsView = [[ChatsView alloc] initWithNibName:@"ChatsView" bundle:nil]; 

我点击ChatsView.xib找到“文件的所有者” ,然后将鼠标悬停我的鼠标在“文件的所有者”,并点击右键,会提示是这样的:

The unconnected 'view' outlet

你必须拖动“视图”出口连接到查看其中有两个子视图:搜索栏&我的xib文件中的表视图。

The connected 'view' outlet

希望我的英语不好可以帮助你解决你的问题:)

相关问题