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)