simple app crashing? - iphone

I have a very simple window based app, i am simply putting a navigation view controller as window's root view controller and it's crashing. This is the only thing i changed in the template project:
#interface AppDelegate : NSObject <UIApplicationDelegate> {
UINavigationController *navigationController;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
navigationController = [[UINavigationController alloc] init];
[[self window] setRootViewController:navigationController];
[self.window makeKeyAndVisible];
return YES;
}
It crashes saying:
2011-05-26 20:18:57.194 ZebraSDKTest[5560:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UICustomObject 0x8b3d760> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key navigationController.'
*** Call stack at first throw:
(
0 CoreFoundation 0x00dbf5a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f13313 objc_exception_throw + 44
2 CoreFoundation 0x00dbf4e1 -[NSException raise] + 17
3 Foundation 0x00791677 _NSSetUsingKeyValueSetter + 135
4 Foundation 0x007915e5 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x0020d30c -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x00d358cf -[NSArray makeObjectsPerformSelector:] + 239
7 UIKit 0x0020bd23 -[UINib instantiateWithOwner:options:] + 1041
8 UIKit 0x0020dab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
9 UIKit 0x0001317a -[UIApplication _loadMainNibFile] + 172
10 UIKit 0x00013cf4 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 291
11 UIKit 0x0001e617 -[UIApplication handleEvent:withNewEvent:] + 1533
12 UIKit
0x00016abf -[UIApplication sendEvent:] + 71
13 UIKit 0x0001bf2e _UIApplicationHandleEvent + 7576
14 GraphicsServices 0x00ff8992 PurpleEventCallback + 1550
15 CoreFoundation 0x00da0944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
16 CoreFoundation 0x00d00cf7 __CFRunLoopDoSource1 + 215
17 CoreFoundation 0x00cfdf83 __CFRunLoopRun + 979
18 CoreFoundation 0x00cfd840 CFRunLoopRunSpecific + 208
19 CoreFoundation 0x00cfd761 CFRunLoopRunInMode + 97
20 UIKit 0x000137d2 -[UIApplication _run] + 623
21 UIKit 0x0001fc93 UIApplicationMain + 1160
22 ZebraSDKTest 0x00002549 main + 121
23 ZebraSDKTest 0x000024c5 start + 53
)

Looks like you have a connection to a former existing UINavigationController IBOutlet in one of your nib files.
Start with MainWindow.xib and check for such a connection.

I had this problem occurring on the simulator only, but on the device it was working fine.
I tried cleaning the project, restarting Xcode, debugging, emptying the simulator data, the whole works.
In the end it was resolved by uninstalling the app from the simulator and reinstalling it. No idea why that worked, but it solved it!

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

NSUnknownKeyException Causing Crash on Button Click [duplicate]

This question already has answers here:
Xcode - How to fix 'NSUnknownKeyException', reason: … this class is not key value coding-compliant for the key X" error?
(79 answers)
Closed 7 years ago.
So I'm not sure what is going on. I haven't really changed much. Nothing having to do with this class anyways. It was working fine just a bit before and now I'm getting this crash.
-(IBAction)mphButton:(id)sender{
if(self.mphVC == nil){
MphViewController *mph = [[MphViewController alloc] initWithNibName:#"MphView" bundle:[NSBundle mainBundle]];
self.mphVC = mph;
[mph release];
}
[self.navigationController pushViewController:self.mphVC animated:YES];
}
The thread is stopping saying "Thread 1: Program received signal "SIGABRT" on the [self.navigationController pushViewController:self.mphVC animated:YES];
This is what the message:
2011-09-29 10:59:03.557 SpeedClock[2973:b303] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<MphViewController 0x4b42ad0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key count.'
*** Call stack at first throw:
(
0 CoreFoundation 0x00dc25a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x00f16313 objc_exception_throw + 44
2 CoreFoundation 0x00dc24e1 -[NSException raise] + 17
3 Foundation 0x00794677 _NSSetUsingKeyValueSetter + 135
4 Foundation 0x007945e5 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x0021030c -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x00d388cf -[NSArray makeObjectsPerformSelector:] + 239
7 UIKit 0x0020ed23 -[UINib instantiateWithOwner:options:] + 1041
8 UIKit 0x00210ab7 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
9 UIKit 0x000c6628 -[UIViewController _loadViewFromNibNamed:bundle:] + 70
10 UIKit 0x000c4134 -[UIViewController loadView] + 120
11 UIKit 0x000c400e -[UIViewController view] + 56
12 UIKit 0x000c2482 -[UIViewController contentScrollView] + 42
13 UIKit 0x000d2f25 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 48
14 UIKit 0x000d1555 -[UINavigationController _layoutViewController:] + 43
15 UIKit 0x000d2870 -[UINavigationController _startTransition:fromViewController:toViewController:] + 524
16 UIKit 0x000cd32a -[UINavigationController _startDeferredTransitionIfNeeded] + 266
17 UIKit 0x000d4562 -[UINavigationController pushViewController:transition:forceImmediate:] + 932
18 UIKit 0x000cd1c4 -[UINavigationController pushViewController:animated:] + 62
19 SpeedClock 0x00002621 -[RootViewController mphButton:] + 353
20 UIKit 0x000144fd -[UIApplication sendAction:to:from:forEvent:] + 119
21 UIKit 0x000a4799 -[UIControl sendAction:to:forEvent:] + 67
22 UIKit 0x000a6c2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
23 UIKit 0x000a57d8 -[UIControl touchesEnded:withEvent:] + 458
24 UIKit 0x00038ded -[UIWindow _sendTouchesForEvent:] + 567
25 UIKit 0x00019c37 -[UIApplication sendEvent:] + 447
26 UIKit 0x0001ef2e _UIApplicationHandleEvent + 7576
27 GraphicsServices 0x00ffb992 PurpleEventCallback + 1550
28 CoreFoundation 0x00da3944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
29 CoreFoundation 0x00d03cf7 __CFRunLoopDoSource1 + 215
30 CoreFoundation 0x00d00f83 __CFRunLoopRun + 979
31 CoreFoundation 0x00d00840 CFRunLoopRunSpecific + 208
32 CoreFoundation 0x00d00761 CFRunLoopRunInMode + 97
33 GraphicsServices 0x00ffa1c4 GSEventRunModal + 217
34 GraphicsServices 0x00ffa289 GSEventRun + 115
35 UIKit 0x00022c93 UIApplicationMain + 1160
36 SpeedClock 0x00001f59 main + 121
37 SpeedClock 0x00001ed5 start + 53
38 ??? 0x00000001 0x0 + 1
)
terminate called throwing an exceptionCurrent language: auto; currently objective-c
(gdb)
I can read these pretty well on Logcat on android. Just not use to reading this one. I saw another post saying that their class might not have been connected to their view. Mine is. It was working just fine prior to me putting in some stuff (which I recommented out and it still isnt working) on the MPHViewController.m
Any and all help is appreciated... Thanks :)
You most likely have something in your "MphView" XIB file called "count" that you no longer have in MphViewController. Maybe a delegate set for an object that's no longer there, or an action, or something like that. Check all your connections in Interface Builder and remove any broken ones.

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)

XCode Error For IPhone App

Brand new to Iphone development,
My app loads but then it crashes right away, in the console I get this reason:
reason: '[<MyViewController 0x6939d60> setValue:forUndefinedKey:]:this class is not key value coding-compliant for the key delegate.'
Stack:
*** Call stack at first throw:
(
0 CoreFoundation 0x0273cb99 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0288c40e objc_exception_throw + 47
2 CoreFoundation 0x0273cad1 -[NSException raise] + 17
3 Foundation 0x000310f3 _NSSetUsingKeyValueSetter + 135
4 Foundation 0x00031061 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x004af70a -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x026b2d0f -[NSArray makeObjectsPerformSelector:] + 239
7 UIKit 0x004ae121 -[UINib instantiateWithOwner:options:] + 1041
8 UIKit 0x004afeb5 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
9 UIKit 0x0036595f -[UIViewController _loadViewFromNibNamed:bundle:] + 70
10 UIKit 0x00363675 -[UIViewController loadView] + 120
11 UIKit 0x0036354f -[UIViewController view] + 56
12 HalloweenNoise 0x0000238d -[MyAppDelegate application:didFinishLaunchingWithOptions:] + 74
13 UIKit 0x002b9f27 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
14 UIKit 0x002bc3b0 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 346
15 UIKit 0x002c63ec -[UIApplication handleEvent:withNewEvent:] + 1958
16 UIKit 0x002beb3c -[UIApplication sendEvent:] + 71
17 UIKit 0x002c39bf _UIApplicationHandleEvent + 7672
18 GraphicsServices 0x0301c822 PurpleEventCallback + 1550
19 CoreFoundation 0x0271dff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
20 CoreFoundation 0x0267e807 __CFRunLoopDoSource1 + 215
21 CoreFoundation 0x0267ba93 __CFRunLoopRun + 979
22 CoreFoundation 0x0267b350 CFRunLoopRunSpecific + 208
23 CoreFoundation 0x0267b271 CFRunLoopRunInMode + 97
24 UIKit 0x002bbc6d -[UIApplication _run] + 625
25 UIKit 0x002c7af2 UIApplicationMain + 1160
26 My 0x00002320 main + 102
27 My 0x000022b1 start + 53
Here's my IBOutlet References (i think):
#property (nonatomic, retain) IBOutlet UIWindow *window;
#property (nonatomic, retain) IBOutlet MyViewController *viewController;
I can post some of my other source, but I'm not quite sure what would be relevant to this error, What does it mean?
Open up your XIB in IB and look at the MyViewController's links. There will be an inbound link to "delegate" that you need to delete.
Your view controller shouldn't be marked IBOutlet probably. Didn't it give you a stacktrace -- with the file and line# of the code that's having this issue?
What are you doing with the ViewController outlet? Did you connect that to something in IB?
Make sure your outlets are connected properly in IB - I've had this error when I change the name of an IBOutlet, but forget to change the connection in IB to the new IBOutlet (it's still trying to connect to the old variable name)

App terminates after viewcontroller calls the delegate to close the view

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.