Objective-C warnings - what did I missing or what is wrong?
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 ho开发者_JAVA技巧w 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
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.
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.
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.
精彩评论