Objective-C 警告 - 我错过了什么或者出了什么问题?
我是编程新手,现在正在编写一个有 6 个视图的应用程序。 我的程序并没有真正启动,我只看到背景 - default.png - 然后 prpgramm 崩溃,但我看到默认图像。 此外,我在理解收到的警告时遇到了问题,它就像一门新语言。 如果您知道一本书或一页如何解码此警告,这也会非常有帮助,
2011-10-10 17:22:16.249 TestTest[2642:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "TestTestViewController" nib but the view outlet was not set.'
(
0 CoreFoundation 0x00ec25a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x01016313 objc_exception_throw + 44
2 CoreFoundation 0x00e7aef8 +[NSExceptionraise:format:arguments:] + 136
3 CoreFoundation 0x00e7ae6a +[NSException raise:format:] + 58
4 UIKit 0x0036b709 -[UIViewController _loadViewFromNibNamed:bundle:] + 295
5 UIKit 0x00369134 -[UIViewController loadView] + 120
6 UIKit 0x0036900e -[UIViewController view] + 56
7 UIKit 0x002dcd42 -[UIWindow addRootViewControllerViewIfPossible] + 51
8 UIKit 0x002dc22d -[UIWindow _setHidden:forced:] + 303
9 UIKit 0x002dc01d -[UIWindow _orderFrontWithoutMakingKey] + 50
10 UIKit 0x002dacd1 -[UIWindow makeKeyAndVisible] + 39
11 TestTest 0x000026be -[TestTestAppDelegate application:didFinishLaunchingWithOptions:] + 135
12 UIKit 0x002b9c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
13 UIKit 0x002bbd88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
14 UIKit 0x002c6617 -[UIApplication handleEvent:withNewEvent:] + 1533
15 UIKit 0x002beabf -[UIApplication sendEvent:] + 71
16 UIKit 0x002c3f2e _UIApplicationHandleEvent + 7576
17 GraphicsServices 0x0181a992 PurpleEventCallback + 1550
18 CoreFoundation 0x00ea3944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
19 CoreFoundation 0x00e03cf7 __CFRunLoopDoSource1 + 215
20 CoreFoundation 0x00e00f83 __CFRunLoopRun + 979
21 CoreFoundation 0x00e00840 CFRunLoopRunSpecific + 208
22 CoreFoundation 0x00e00761 CFRunLoopRunInMode + 97
23 UIKit 0x002bb7d2 -[UIApplication _run] + 623
24 UIKit 0x002c7c93 UIApplicationMain + 1160
25 TestTest 0x00002614 main + 102
26 TestTest 0x000025a5 start + 53
27 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
kill
quit
The Debugger has exited with status 0.(gdb)
提前谢谢您
I am new at programming and now I am writing an application with 6 views.
My program starts not really, I only see the background - the default.png - and then the prpgramm crashes but I see the default- image.
In addition i have problems understanding the warnings I recieve, it is like a new language.
If you know a book or a page how to decode this warnings it would be very helpful too
2011-10-10 17:22:16.249 TestTest[2642:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "TestTestViewController" nib but the view outlet was not set.'
(
0 CoreFoundation 0x00ec25a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x01016313 objc_exception_throw + 44
2 CoreFoundation 0x00e7aef8 +[NSExceptionraise:format:arguments:] + 136
3 CoreFoundation 0x00e7ae6a +[NSException raise:format:] + 58
4 UIKit 0x0036b709 -[UIViewController _loadViewFromNibNamed:bundle:] + 295
5 UIKit 0x00369134 -[UIViewController loadView] + 120
6 UIKit 0x0036900e -[UIViewController view] + 56
7 UIKit 0x002dcd42 -[UIWindow addRootViewControllerViewIfPossible] + 51
8 UIKit 0x002dc22d -[UIWindow _setHidden:forced:] + 303
9 UIKit 0x002dc01d -[UIWindow _orderFrontWithoutMakingKey] + 50
10 UIKit 0x002dacd1 -[UIWindow makeKeyAndVisible] + 39
11 TestTest 0x000026be -[TestTestAppDelegate application:didFinishLaunchingWithOptions:] + 135
12 UIKit 0x002b9c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
13 UIKit 0x002bbd88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
14 UIKit 0x002c6617 -[UIApplication handleEvent:withNewEvent:] + 1533
15 UIKit 0x002beabf -[UIApplication sendEvent:] + 71
16 UIKit 0x002c3f2e _UIApplicationHandleEvent + 7576
17 GraphicsServices 0x0181a992 PurpleEventCallback + 1550
18 CoreFoundation 0x00ea3944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
19 CoreFoundation 0x00e03cf7 __CFRunLoopDoSource1 + 215
20 CoreFoundation 0x00e00f83 __CFRunLoopRun + 979
21 CoreFoundation 0x00e00840 CFRunLoopRunSpecific + 208
22 CoreFoundation 0x00e00761 CFRunLoopRunInMode + 97
23 UIKit 0x002bb7d2 -[UIApplication _run] + 623
24 UIKit 0x002c7c93 UIApplicationMain + 1160
25 TestTest 0x00002614 main + 102
26 TestTest 0x000025a5 start + 53
27 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Program received signal: “SIGABRT”.
kill
quit
The Debugger has exited with status 0.(gdb)
Thank you in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您已在 NIB 内创建了一个视图控制器,但未能为其提供视图。您应该通过将视图放入 NIB 中并从视图控制器到视图按住 Control 单击,然后从出现的弹出窗口中选择视图出口来完成此操作,即在界面设计器中连接事物的正常方式。
您看到的错误是 UIViewController 故意引发的异常,因为它不知道如何在没有视图的情况下继续操作。下面的东西是堆栈跟踪;如果问题出在您自己的代码中,您可以使用它来调查是什么调用模式使您进入无效状态。由于它位于一堆内部内容中,其逻辑结构已记录,但内部实现是私有的,因此您应该忽略它。
You've created a view controller inside a NIB but you've failed to give it a view. You should do that by putting a view into the NIB and control-clicking from the view controller to the view and then selecting the view outlet from the pop-up that appears — i.e. the normal way of connecting things in the interface designer.
The error you're seeing is an exception raised deliberately by UIViewController because it doesn't know how to proceed without a view. The stuff below that is the stack trace; if the problem were in your own code you could use that to look into what calling pattern got you into the invalid state. As it's in a bunch of internal stuff for which the logical structure is documented but the internal implementation is private you should just ignore it.
查看崩溃报告的第一行,崩溃原因非常明显:
加载了“TestTestViewController”笔尖,但未设置视图出口。
Looking at first line of your crash report, reason for crash is quite obvious:
loaded the "TestTestViewController" nib but the view outlet was not set.
回顾您正在使用的任何文本,了解如何创建视图控制器和 XIB 文件,并找出您错过的步骤。
Go back through whatever text you are using to learn about how to create view controllers and XIB files and figure out what step you missed.