App terminates after viewcontroller calls the delegate to close the view - iphone

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

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.

Related

Why is my iPhone app crashing with the exception "Could not load NIB in bundle"?

I am learning how to make iPhone apps in the simulator but my app crashes as soon as it launches in the simulator. Also, there are no errors and no warnings when I compile the source code.
Here is a copy of the console logs -
2011-10-27 04:49:08.376 login[1192:207] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'LoginView''
* Call stack at first throw:
(
0 CoreFoundation 0x00dc85a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f1c313 objc_exception_throw + 44
2 CoreFoundation 0x00d80ef8 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x00d80e6a +[NSException raise:format:] + 58
4 UIKit 0x004b30fa -[UINib instantiateWithOwner:options:] + 2024
5 UIKit 0x004b4ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
6 UIKit 0x0036a628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
7 UIKit 0x00368134 -[UIViewController loadView] + 120
8 UIKit 0x0036800e -[UIViewController view] + 56
9 login 0x000029c3 -[loginViewController viewDidLoad] + 165
10 UIKit 0x004b2f26 -[UINib instantiateWithOwner:options:] + 1556
11 UIKit 0x004b4ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
12 UIKit 0x002ba17a -[UIApplication _loadMainNibFile] + 172
13 UIKit 0x002bacf4 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 291
14 UIKit 0x002c5617 -[UIApplication handleEvent:withNewEvent:] + 1533
15 UIKit 0x002bdabf -[UIApplication sendEvent:] + 71
16 UIKit 0x002c2f2e _UIApplicationHandleEvent + 7576
17 GraphicsServices 0x01720992 PurpleEventCallback + 1550
18 CoreFoundation 0x00da9944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
19 CoreFoundation 0x00d09cf7 __CFRunLoopDoSource1 + 215
20 CoreFoundation 0x00d06f83 __CFRunLoopRun + 979
21 CoreFoundation 0x00d06840 CFRunLoopRunSpecific + 208
22 CoreFoundation 0x00d06761 CFRunLoopRunInMode + 97
23 UIKit 0x002ba7d2 -[UIApplication _run] + 623
24 UIKit 0x002c6c93 UIApplicationMain + 1160
25 login 0x00002694 main + 102
26 login 0x00002625 start + 53
)
terminate called after throwing an instance of 'NSException'
I have tried and tried and can't seem to fix this problem. I will appreciate any help.
Your app is trying to load a file called LoginView.xib, and failing to. Seems like this file is referenced from your MainWindow.xib (or whichever is your main nib file as defined in your application plist). Check that this file exists, is copied to the bundle (in the copy resources build phase). If that's the case you can try cleaning the project, restarting xCode and trying again (I had this problem occasionally, for no apparent reason when switching between iPhone/iPad targets).

App crash after modification on the XIB files

After adding a new searchbar on the RootViewController.xib, and connecting it with the FileOwner, the App will crash. It reports the stack when crash:
2011-07-17 17:12:43.756 TableView[1397:207] *** Terminating app due to uncaught
exception 'NSInternalInconsistencyException', reason: '-[UIViewController
_loadViewFromNibNamed:bundle:] loaded the "RootViewController" nib but the view outlet
was not set.'
*** Call stack at first throw:
(
0 CoreFoundation 0x00dc85a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f1c313 objc_exception_throw + 44
2 CoreFoundation 0x00d80ef8 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x00d80e6a +[NSException raise:format:] + 58
4 UIKit 0x0036a709 -[UIViewController _loadViewFromNibNamed:bundle:] + 295
5 UIKit 0x00368134 -[UIViewController loadView] + 120
6 UIKit 0x004c1dd8 -[UITableViewController loadView] + 80
7 UIKit 0x0036800e -[UIViewController view] + 56
8 UIKit 0x003667f5 -[UIViewController nextResponder] + 34
9 UIKit 0x003874a6 -[UIResponder _containsResponder:] + 41
10 UIKit 0x00371c4e -[UINavigationController defaultFirstResponder] + 80
11 UIKit 0x00386647 -[UIResponder(Internal) _deepestDefaultFirstResponder] + 42
12 UIKit 0x00386663 -[UIResponder(Internal) _deepestDefaultFirstResponder] + 70
13 UIKit 0x00386406 -[UIResponder(Internal) _promoteDeepestDefaultFirstResponder] + 42
14 TableView 0x00002a0a -[TableViewAppDelegate application:didFinishLaunchingWithOptions:] + 135
15 UIKit 0x002b8c89 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
16 UIKit 0x002bad88 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
17 UIKit 0x002c5617 -[UIApplication handleEvent:withNewEvent:] + 1533
18 UIKit 0x002bdabf -[UIApplication sendEvent:] + 71
19 UIKit 0x002c2f2e _UIApplicationHandleEvent + 7576
20 GraphicsServices 0x01720992 PurpleEventCallback + 1550
21 CoreFoundation 0x00da9944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
22 CoreFoundation 0x00d09cf7 __CFRunLoopDoSource1 + 215
23 CoreFoundation 0x00d06f83 __CFRunLoopRun + 979
24 CoreFoundation 0x00d06840 CFRunLoopRunSpecific + 208
25 CoreFoundation 0x00d06761 CFRunLoopRunInMode + 97
26 UIKit 0x002ba7d2 -[UIApplication _run] + 623
27 UIKit 0x002c6c93 UIApplicationMain + 1160
28 TableView 0x00002960 main + 102
29 TableView 0x000028f1 start + 53
30 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Well I don't know what you want us to tell you more then your error is already telling you.
Terminating app due to uncaught exception
'NSInternalInconsistencyException', reason: '-[UIViewController
_loadViewFromNibNamed:bundle:] loaded the "RootViewController" nib but
the view outlet was not set.'
That is that you forgot to connect your view outlet of your RootViewController so it does not know what to load. The RootViewController of your MainWindow is the first thing that's going to be loaded, if it does not know what view it should display it will give you the above error.

terminate called after thrwing an instance of 'NSException'

plz help me to resolve this
i m a learner
[Session started at 2011-01-10 14:32:07 +0530.]
2011-01-10 14:32:10.595 balls[963:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "ballsViewController" nib but the view outlet was not set.'
*** Call stack at first throw:
(
0 CoreFoundation 0x025a5b99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0239a40e objc_exception_throw + 47
2 CoreFoundation 0x0255e238 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x0255e1aa +[NSException raise:format:] + 58
4 UIKit 0x00363a40 -[UIViewController _loadViewFromNibNamed:bundle:] + 295
5 UIKit 0x00361675 -[UIViewController loadView] + 120
6 UIKit 0x0036154f -[UIViewController view] + 56
7 balls 0x00001fc1 -[ballsAppDelegate application:didFinishLaunchingWithOptions:] + 74
8 UIKit 0x002b7f27 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
9 UIKit 0x002ba3b0 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 346
10 UIKit 0x002c43ec -[UIApplication handleEvent:withNewEvent:] + 1958
11 UIKit 0x002bcb3c -[UIApplication sendEvent:] + 71
12 UIKit 0x002c19bf _UIApplicationHandleEvent + 7672
13 GraphicsServices 0x030f0822 PurpleEventCallback + 1550
14 CoreFoundation 0x02586ff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
15 CoreFoundation 0x024e7807 __CFRunLoopDoSource1 + 215
16 CoreFoundation 0x024e4a93 __CFRunLoopRun + 979
17 CoreFoundation 0x024e4350 CFRunLoopRunSpecific + 208
18 CoreFoundation 0x024e4271 CFRunLoopRunInMode + 97
19 UIKit 0x002b9c6d -[UIApplication _run] + 625
20 UIKit 0x002c5af2 UIApplicationMain + 1160
21 balls 0x00001f54 main + 102
22 balls 0x00001ee5 start + 53
)
terminate called after throwing an instance of 'NSException'
Go to ballsViewController's xib and check whether the View is connected to Files Owner or not.
If not than control click on the View and drag the mouse to the files owner

app crashes after xib edit

I have a navigation controller app. I created a RootViewController class with Xib file. In that xib file I had table view and nothing more else. Toolbar and buttons on the toolbar I created in program way. Table view had datasourse and delegate File Owner.
I deleted this xib file, and created a new one with previous name. Created it like viewBased xib file and then I dropped down to it table view, toolbar, two buttons on toolbar. Add outlets on them. Saved it all. Clear all targets. Build all. And Run. Application crashes on start! Anyone know where may be the problem? Thanx!
Stack:
[Session started at 2010-11-16 15:00:52 +0200.]
2010-11-16 15:00:53.729 PhoneBook[16210:207] ******* Accessibility Status Changed: On
2010-11-16 15:00:53.755 PhoneBook[16210:207] ********** Loading AX for: com.yourcompany.PhoneBook ************
2010-11-16 15:00:53.798 PhoneBook[16210:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "RootViewController" nib but the view outlet was not set.'
*** Call stack at first throw:
(
0 CoreFoundation 0x02510b99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0266040e objc_exception_throw + 47
2 CoreFoundation 0x024c9238 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x024c91aa +[NSException raise:format:] + 58
4 UIKit 0x0036aa40 -[UIViewController _loadViewFromNibNamed:bundle:] + 295
5 UIKit 0x00368675 -[UIViewController loadView] + 120
6 UIKit 0x004c1c8c -[UITableViewController loadView] + 80
7 UIKit 0x0036854f -[UIViewController view] + 56
8 UIKit 0x003669f4 -[UIViewController contentScrollView] + 42
9 UIKit 0x003767e2 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
10 UIKit 0x00374ea3 -[UINavigationController _layoutViewController:] + 43
11 UIKit 0x0037612d -[UINavigationController _startTransition:fromViewController:toViewController:] + 524
12 UIKit 0x00370ccd -[UINavigationController _startDeferredTransitionIfNeeded] + 266
13 UIKit 0x0048db55 -[UILayoutContainerView layoutSubviews] + 226
14 QuartzCore 0x0456a481 -[CALayer layoutSublayers] + 177
15 QuartzCore 0x0456a1b1 CALayerLayoutIfNeeded + 220
16 QuartzCore 0x045632e0 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 302
17 QuartzCore 0x04563040 _ZN2CA11Transaction6commitEv + 292
18 UIKit 0x002c104e -[UIApplication _reportAppLaunchFinished] + 39
19 UIKit 0x002c1477 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 545
20 UIKit 0x002cb3ec -[UIApplication handleEvent:withNewEvent:] + 1958
21 UIKit 0x002c3b3c -[UIApplication sendEvent:] + 71
22 UIKit 0x002c89bf _UIApplicationHandleEvent + 7672
23 GraphicsServices 0x02d6c822 PurpleEventCallback + 1550
24 CoreFoundation 0x024f1ff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
25 CoreFoundation 0x02452807 __CFRunLoopDoSource1 + 215
26 CoreFoundation 0x0244fa93 __CFRunLoopRun + 979
27 CoreFoundation 0x0244f350 CFRunLoopRunSpecific + 208
28 CoreFoundation 0x0244f271 CFRunLoopRunInMode + 97
29 UIKit 0x002c0c6d -[UIApplication _run] + 625
30 UIKit 0x002ccaf2 UIApplicationMain + 1160
31 PhoneBook 0x00002494 main + 102
32 PhoneBook 0x00002425 start + 53
)
terminate called after throwing an instance of 'NSException'
* Terminating app due to uncaught exception
'NSInternalInconsistencyException',
reason: '-[UIViewController
_loadViewFromNibNamed:bundle:] loaded the "RootViewController" nib but the
view outlet was not set.'
Your view controller lost connection for view outlet, you need to restore it in IB (as you do with all outlets)

App crashes when I pop a view from NavigationController using a UIButton

I'm pushing a simple view onto a NavigationController. The view loads fine, and when I use the built-in back button, it is properly popped.
However, when I try and pop the view with my own UIButton within the view, I get a crash.
This is the action run by my UIButton:
-(IBAction)iAgreePressed {
[[self navigationController] popViewControllerAnimated:YES];}
Am I missing something obvious here?
This is the error coming back in the console:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[LegalAgreementController iAgreePressed:]: unrecognized selector sent to instance 0x6169190'
*** Call stack at first throw:
(
0 CoreFoundation 0x0283ab99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0298a40e objc_exception_throw + 47
2 CoreFoundation 0x0283c6ab -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x027ac2b6 ___forwarding___ + 966
4 CoreFoundation 0x027abe72 _CF_forwarding_prep_0 + 50
5 UIKit 0x002d67f8 -[UIApplication sendAction:to:from:forEvent:] + 119
6 UIKit 0x00361de0 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x00364262 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
8 UIKit 0x00362e0f -[UIControl touchesEnded:withEvent:] + 458
9 UIKit 0x002fa3d0 -[UIWindow _sendTouchesForEvent:] + 567
10 UIKit 0x002dbcb4 -[UIApplication sendEvent:] + 447
11 UIKit 0x002e09bf _UIApplicationHandleEvent + 7672
12 GraphicsServices 0x02f57822 PurpleEventCallback + 1550
13 CoreFoundation 0x0281bff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
14 CoreFoundation 0x0277c807 __CFRunLoopDoSource1 + 215
15 CoreFoundation 0x02779a93 __CFRunLoopRun + 979
16 CoreFoundation 0x02779350 CFRunLoopRunSpecific + 208
17 CoreFoundation 0x02779271 CFRunLoopRunInMode + 97
18 GraphicsServices 0x02f5600c GSEventRunModal + 217
19 GraphicsServices 0x02f560d1 GSEventRun + 115
20 UIKit 0x002e4af2 UIApplicationMain + 1160
21 WeiglWorksMobileCommander 0x00001fa2 main + 84
22 WeiglWorksMobileCommander 0x00001f45 start + 53
23 ??? 0x00000001 0x0 + 1
)
terminate called after throwing an instance of 'NSException'
Thank you for your time!
Method signatures don't match. The button is sending
-[LegalAgreementController iAgreePressed:]
but you defined
-[LegalAgreementController iAgreePressed] //(note one arg versus no arg)
IBActions should be defined as:
- (IBAction) someMethod:(id)sender
You don't strictly have to include that arg, but you want to for consistency.