0

这里的情况:我有一个视图控制器,它在函数“viewDidLoad”中调用 AppDelegateIphone 中的一个函数来终止这个视图。问题是,如果我这样做,就会出现这个异常:

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”.

如果我在 appDelegate 本身中调用该函数splashScreen.view = nil;,那么一切正常。

请告诉我我的错在哪里,或者我应该发布更多代码。

问候

4

1 回答 1

0
加载了“SplashScreenController_iPhone”笔尖,但未设置视图出口。

您是否在界面生成器中制作了视图插座?似乎您没有正确设置它。而且从堆栈跟踪中,很明显 viewDidLoad 还没有被调用,因为视图还没有被成功加载。

于 2010-07-26T14:19:08.067 回答