XCode Error For IPhone App - iphone

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)

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.

simple app crashing?

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!

Apples's Scrolling Example Crashes

I am trying to run the Apple's Scrolling Sample Code, but I get following Error:
Scrolling[45877:207] Unknown class ScrollingAppDelegate in Interface Builder file.
Scrolling[45877:207] Unknown class ScrollingViewController in Interface Builder file.
Scrolling[45877:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UICustomObject 0x4b33330> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key viewController.'
*** Call stack at first throw:
(
0 CoreFoundation 0x00f0cbe9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x010615c2 objc_exception_throw + 47
2 CoreFoundation 0x00f0cb21 -[NSException raise] + 17
3 Foundation 0x000306cf _NSSetUsingKeyValueSetter + 135
4 Foundation 0x0003063d -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x004af8d6 -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x00e832cf -[NSArray makeObjectsPerformSelector:] + 239
7 UIKit 0x004ae2ed -[UINib instantiateWithOwner:options:] + 1041
8 UIKit 0x004b0081 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
9 UIKit 0x002ba943 -[UIApplication _loadMainNibFile] + 172
10 UIKit 0x002bb4ca -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 291
11 UIKit 0x002c5db2 -[UIApplication handleEvent:withNewEvent:] + 1533
12 UIKit 0x002be202 -[UIApplication sendEvent:] + 71
13 UIKit 0x002c3732 _UIApplicationHandleEvent + 7576
14 GraphicsServices 0x01842a36 PurpleEventCallback + 1550
15 CoreFoundation 0x00eee064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
16 CoreFoundation 0x00e4e6f7 __CFRunLoopDoSource1 + 215
17 CoreFoundation 0x00e4b983 __CFRunLoopRun + 979
18 CoreFoundation 0x00e4b240 CFRunLoopRunSpecific + 208
19 CoreFoundation 0x00e4b161 CFRunLoopRunInMode + 97
20 UIKit 0x002bafa8 -[UIApplication _run] + 636
21 UIKit 0x002c742e UIApplicationMain + 1160
22 Scrolling 0x0000279c main + 102
23 Scrolling 0x0000272d start + 53
)
terminate called after throwing an instance of 'NSException'
The weird thing is, that I can't find those connections in the MainWindow.xib (The only xib file). The Outlets are properly connected to the AppDelegate and MyViewController classes.
The Runtime cannot find a way to create an instance of the classes "ScrollingAppDelegate" and "ScrollingViewController", which are serialized in the xib file. So it defaults to UICustomObject, which you don't have either.
Are you sure those classes exist in your source file(s) and that they are compiled correctly (i.e., part of the "Compile" build phase)?
Also check the spelling and the capitalization of the classes. It has to match between the xib files and the source files.
If something is wrong, there could be a yellow warning dot in the xib file (bottom-right). Click it for more info.
Finally, the sample code is marked as iOS4+. Do you have iOS 4 on your device?

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)