terminate called after throwing an instance of 'NSException' (gdb) - iphone

I've made an app with 6 months of work with no backups. It works fine on Simulator but on device it crashes.
This is the error code:
2011-09-11 17:55:49.172 Apli[223:707] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle /var/mobile/Applications/FC234696-314B-4328-94BF-A73506B8AB07/Apli.app> (loaded)' with name 'MainWindow''
*** Call stack at first throw:
(
0 CoreFoundation 0x3438664f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x36879c5d objc_exception_throw + 24
2 CoreFoundation 0x34386491 +[NSException raise:format:arguments:] + 68
3 CoreFoundation 0x343864cb +[NSException raise:format:] + 34
4 UIKit 0x34b03a53 -[UINib instantiateWithOwner:options:] + 1110
5 UIKit 0x34b04e09 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 92
6 UIKit 0x3492f4cd -[UIApplication _loadMainNibFile] + 96
7 UIKit 0x34929b09 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 180
8 UIKit 0x348fe7d7 -[UIApplication handleEvent:withNewEvent:] + 1114
9 UIKit 0x348fe215 -[UIApplication sendEvent:] + 44
10 UIKit 0x348fdc53 _UIApplicationHandleEvent + 5090
11 GraphicsServices 0x33a56e77 PurpleEventCallback + 666
12 CoreFoundation 0x3435da97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
13 CoreFoundation 0x3435f83f __CFRunLoopDoSource1 + 166
14 CoreFoundation 0x3436060d __CFRunLoopRun + 520
15 CoreFoundation 0x342f0ec3 CFRunLoopRunSpecific + 230
16 CoreFoundation 0x342f0dcb CFRunLoopRunInMode + 58
17 UIKit 0x34928d49 -[UIApplication _run] + 372
18 UIKit 0x34926807 UIApplicationMain + 670
19 Apli 0x00002bb3 main + 82
20 Apli 0x00002b5c start + 40
)
terminate called after throwing an instance of 'NSException'
(gdb)

Check that your MainWindow.XIB file is still in your project, and especially is checked to be included in your target.
I guess that your MainWindow.xib is not check to be included to your final Apli.app package, that explains why it is not found in your Bundle.
If you didn't "Clean" your previous builds of your app, a previous version of your compiled app bundle, including the MainWindow.xib file, may still be present in your simulator, explaining why the simulator still finds it. (If you "Clean all targets" from the "Build" menu, then rebuild your app on the simulator, I bet the simulator won't find your XIB file neither)

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

Could not load NIB in bundle [...] with name 'MainWindow' only on iPhone 4

I have a Problem with my App. It is working perfectly on my iPhone 3GS, but now where I tried to test it on an iPhone 4, it is crashing while the Splashscreen is visible.
Here's the log:
2011-07-06 16:01:05.611 Apptest [294:607] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </var/mobile/Applications/0C371068-7E74-4C54-997C-80E3B0929411/Apptest.app> (loaded)' with name 'MainWindow''
*** Call stack at first throw:
(
0 CoreFoundation 0x311ec64f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x3494dc5d objc_exception_throw + 24
2 CoreFoundation 0x311ec491 +[NSException raise:format:arguments:] + 68
3 CoreFoundation 0x311ec4cb +[NSException raise:format:] + 34
4 UIKit 0x368c9a53 -[UINib instantiateWithOwner:options:] + 1110
5 UIKit 0x368cae09 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 92
6 UIKit 0x366f54cd -[UIApplication _loadMainNibFile] + 96
7 UIKit 0x366efb09 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 180
8 UIKit 0x366c47d7 -[UIApplication handleEvent:withNewEvent:] + 1114
9 UIKit 0x366c4215 -[UIApplication sendEvent:] + 44
10 UIKit 0x366c3c53 _UIApplicationHandleEvent + 5090
11 GraphicsServices 0x36398e77 PurpleEventCallback + 666
12 CoreFoundation 0x311c3a97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
13 CoreFoundation 0x311c583f __CFRunLoopDoSource1 + 166
14 CoreFoundation 0x311c660d __CFRunLoopRun + 520
15 CoreFoundation 0x31156ec3 CFRunLoopRunSpecific + 230
16 CoreFoundation 0x31156dcb CFRunLoopRunInMode + 58
17 UIKit 0x366eed49 -[UIApplication _run] + 372
18 UIKit 0x366ec807 UIApplicationMain + 670
19 Apptest 0x00002a0b main + 82
20 Apptest 0x000029b4 start + 40
)
terminate called after throwing an instance of 'NSException'
I hope you can help me. Thanks in advance.
Does the MainWindow.xib actually exist in your project?
You may have deleted it by accident. It may still work on the 3GS even if you deleted it from your project as it may well still be in the bundle on the 3GS.
I normally clean my projects and reset the simulator/uninstall the app from my device if I get inconsistencies like this.

Can we share controll file in an univarsal (iPhone, iPad) Application?

I developed a univarsal application,(iPhone, iPad). But later I tried to make them sepret, so i copied my folder in another directory and then linked my iPhone's control file with iPad's XIBs, and delegated them with Outlets, (my controll file remained in the iPhone folder, i just link them in iPad), after it i removed iPhone XIBs from this folder.
Now my project is working properly, BUT only if I execute the iPhone version first(even from that different directory), and then execute my iPad version, coz it share's the build file of iPhone.
But when I try to execute it Initially (after deleting prior installed version from simulator), it doesn't work, as it terminate after throwing following exception.
2011-04-23 10:56:01.831 Tuscany[1837:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSURL initFileURLWithPath:]: nil string parameter'
*** Call stack at first throw:
(
0 CoreFoundation 0x01683be9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x014785c2 objc_exception_throw + 47
2 CoreFoundation 0x0163c628 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x0163c59a +[NSException raise:format:] + 58
4 Foundation 0x000d6b12 -[NSURL(NSURL) initFileURLWithPath:] + 90
5 Foundation 0x000d6aa0 +[NSURL(NSURL) fileURLWithPath:] + 72
6 Tuscany 0x0003572c -[SplashScreenViewController readyPlayer] + 77
7 Tuscany 0x00035a62 -[SplashScreenViewController viewDidLoad] + 296
8 UIKit 0x003e865e -[UIViewController view] + 179
9 UIKit 0x0035e026 -[UIWindow addRootViewControllerViewIfPossible] + 51
10 UIKit 0x0035d511 -[UIWindow _setHidden:forced:] + 303
11 UIKit 0x0035d301 -[UIWindow _orderFrontWithoutMakingKey] + 50
12 UIKit 0x0a2ac110 -[UIWindowAccessibility(SafeCategory) _orderFrontWithoutMakingKey] + 56
13 UIKit 0x0035bfb5 -[UIWindow makeKeyAndVisible] + 39
14 Tuscany 0x00003205 -[AppDelegate_iPad application:didFinishLaunchingWithOptions:] + 1472
15 UIKit 0x0033b1fa -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1163
16 UIKit 0x0033d55e -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 439
17 UIKit 0x00347db2 -[UIApplication handleEvent:withNewEvent:] + 1533
18 UIKit 0x00340202 -[UIApplication sendEvent:] + 71
19 UIKit 0x00345732 _UIApplicationHandleEvent + 7576
20 GraphicsServices 0x01ce3a36 PurpleEventCallback + 1550
21 CoreFoundation 0x01665064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
22 CoreFoundation 0x015c56f7 __CFRunLoopDoSource1 + 215
23 CoreFoundation 0x015c2983 __CFRunLoopRun + 979
24 CoreFoundation 0x015c2240 CFRunLoopRunSpecific + 208
25 CoreFoundation 0x015c2161 CFRunLoopRunInMode + 97
26 UIKit 0x0033cfa8 -[UIApplication _run] + 636
27 UIKit 0x0034942e UIApplicationMain + 1160
28 Tuscany 0x00002b30 main + 102
29 Tuscany 0x00002ac1 start + 53
)
terminate called after throwing an instance of 'NSException'
here to mention i have worked hard with the line i'm establishing connection, and as i told same code run properly when I execute iPhone version first and then the iPad.
so please guied me with this,
thank you
What it says.
In the readyPlayer method you are trying to give a nil value to the fileUrlWithPath method.
You need to check why the path is nil.

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?

iPhone app crashes on startup

I had two apps in xcode, which i wanted to combine, so i started a new project and attempted to put the two apps together in this new one. Was this a really stupid thing to do?
The app now crashes on start up and i have no idea why, i'm 99% the outlets are all connected. It uses xcdatamodel for storage and i've imported the right framework.
Can anyone think of any other things that could be going wrong?
I can attach a zip file with the project in if someone wouldn't mind having a look
Any help is massively appreciated!
Thanks
This is the stack trace:
2010-11-02 08:18:59.903 iStalker[34745:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x5b10e20> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key textField.'
*** Call stack at first throw:
(
0 CoreFoundation 0x0256f919 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x026bd5de objc_exception_throw + 47
2 CoreFoundation 0x0256f851 -[NSException raise] + 17
3 Foundation 0x0003bc2b _NSSetUsingKeyValueSetter + 135
4 Foundation 0x0003bb99 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 285
5 UIKit 0x004b5d0a -[UIRuntimeOutletConnection connect] + 112
6 CoreFoundation 0x024e5b6f -[NSArray makeObjectsPerformSelector:] + 239
7 UIKit 0x004b4721 -[UINib instantiateWithOwner:options:] + 1041
8 UIKit 0x004b64b5 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 168
9 UIKit 0x002c59bb -[UIApplication _loadMainNibFile] + 172
10 UIKit 0x002c690d -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 198
11 UIKit 0x002d0452 -[UIApplication handleEvent:withNewEvent:] + 1958
12 UIKit 0x002c9074 -[UIApplication sendEvent:] + 71
13 UIKit 0x002cdac4 _UIApplicationHandleEvent + 7495
14 GraphicsServices 0x02dd5afa PurpleEventCallback + 1578
15 CoreFoundation 0x02550dc4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
16 CoreFoundation 0x024b1737 __CFRunLoopDoSource1 + 215
17 CoreFoundation 0x024ae9c3 __CFRunLoopRun + 979
18 CoreFoundation 0x024ae280 CFRunLoopRunSpecific + 208
19 CoreFoundation 0x024ae1a1 CFRunLoopRunInMode + 97
20 UIKit 0x002c6226 -[UIApplication _run] + 625
21 UIKit 0x002d1b58 UIApplicationMain + 1160
22 iStalker 0x00001b50 main + 102
23 iStalker 0x00001ae1 start + 53
)
terminate called after throwing an instance of 'NSException'
Looks like you have a text field connected to the application delegate in your main XIB. There is no such field defined on the real application delegate, which is why you’re getting the error.
Thats because you set main xib for app in info plist and set File Owner to appDelegate, while main xib file's owner is always UIApplication. Possible solution - add Object to .xib, set its class for appDelegate class and connect all unnecessary outlets. This worked for me.