views:

31

answers:

1

Hi experts,

here the situation: i have a viewcontroller which calls in the function "viewDidLoad" a function in the AppDelegateIphone to terminate this view. The problem is that this exception comes if i make this:

splashScreen.view = nil;



    *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "SplashScreenController_iPhone" nib but the view outlet was not set.'
*** Call stack at first throw:
(
 0   CoreFoundation                      0x029dc919 __exceptionPreprocess + 185
 1   libobjc.A.dylib                     0x02b2a5de objc_exception_throw + 47
 2   CoreFoundation                      0x02995078 +[NSException raise:format:arguments:] + 136
 3   CoreFoundation                      0x02994fea +[NSException raise:format:] + 58
 4   UIKit                               0x0062a09c -[UIViewController _loadViewFromNibNamed:bundle:] + 295
 5   UIKit                               0x00627cd1 -[UIViewController loadView] + 120
 6   UIKit                               0x00627bab -[UIViewController view] + 56
 7   regioappv2                          0x00003085 -[AppDelegate_iPhone application:didFinishLaunchingWithOptions:] + 97
 8   UIKit                               0x00580543 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
 9   UIKit                               0x005829a1 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 346
 10  UIKit                               0x0058c452 -[UIApplication handleEvent:withNewEvent:] + 1958
 11  UIKit                               0x00585074 -[UIApplication sendEvent:] + 71
 12  UIKit                               0x00589ac4 _UIApplicationHandleEvent + 7495
 13  GraphicsServices                    0x030bfafa PurpleEventCallback + 1578
 14  CoreFoundation                      0x029bddc4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
 15  CoreFoundation                      0x0291e737 __CFRunLoopDoSource1 + 215
 16  CoreFoundation                      0x0291b9c3 __CFRunLoopRun + 979
 17  CoreFoundation                      0x0291b280 CFRunLoopRunSpecific + 208
 18  CoreFoundation                      0x0291b1a1 CFRunLoopRunInMode + 97
 19  UIKit                               0x00582226 -[UIApplication _run] + 625
 20  UIKit                               0x0058db58 UIApplicationMain + 1160
 21  regioappv2                          0x000028b4 main + 102
 22  regioappv2                          0x00002845 start + 53
)
terminate called after throwing an instance of 'NSException'
Program received signal:  “SIGABRT”.

if I call the function with the splashScreen.view = nil; in the appDelegate itself, then everything is working just fine.

Please tell me where is my fault, or wheather I should post more code.

regards

A: 
loaded the "SplashScreenController_iPhone" nib but the view outlet was not set.

Have you made the view outlet in interface builder? Seems that you have not set it up correctly. And also from the stack trace, it's clear that viewDidLoad haven't been called, as the view is yet to be successfully loaded.

taskinoor
the view was created programmatically in the viewDidLoad of the viewController.So both cases are not given.
plusgut
then why r u trying to load it from nib? if you initFromNib, then you must set the view in nib. cause view must be loaded before viewDidLoad is called.
taskinoor
i don't know why this message is coming, nowhere I'm using nibs.The initialisation of the view is this: splashScreen = [[[SplashScreenController_iPhone alloc] init] autorelease];
plusgut
try to load ur view in loadView method rather than viewDidLoad method and don't call super. (though i have not tried it before).
taskinoor
From the manual, "If you specify the views manually, you must implement the loadView method and use it to assign a root view object to the view property"
taskinoor