0

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) 
MariaEmp
  • 5
  • 5

1 Answers1

1

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)

AliSoftware
  • 32,623
  • 6
  • 82
  • 77
  • Thanks for your reply. I've done a Product > Clean and it doensn´t work. The MainWindows it's on my info plist and in the projetct. What I can do now? Thanks. And it's true... I've haven´t cleaned targets in previous versions of my project. – MariaEmp Sep 11 '11 at 16:26
  • If you're still on Xcode 3.2, simply get the informations (Command-I) on your MainWindow.xib file in your project, and go on the "Targets" tab. There, make sure the checkbox in front of your Target are checked. If you use Xcode4, the target membership of your files are in the right panel, under the tab representing a document icon. – AliSoftware Sep 11 '11 at 16:35
  • Ok, MainWindows it's in my target. Main nib file base name MainWindow.xib but it still give me the error, also i've made a little change in mainwindows and in simulater it changes too – MariaEmp Sep 11 '11 at 16:38
  • Sorry didn't really understood your last comment? And how come you can see changes in the simulator if you cleaned all targets? – AliSoftware Sep 11 '11 at 19:50
  • MainWindow it's set on plist file. I cleaned targets and now It don't work on simulator. Thanks – MariaEmp Sep 11 '11 at 20:06
  • That's normal it does not work in the simulator if you cleaned targets. I explained it in my answer. Your MainWindow.xib is probably not in the "Copy Bundle Resources" phase of your target, you have probably removed it by mistake so you need to add it again (drag&drop on the "Copy Bundle Resources" phase of the target on the left pane of Xcode3) – AliSoftware Sep 11 '11 at 20:13
  • Thanks. I use xcode 4. I dragged & dropped it and selected "copy items into destination group's folder (if needed)". it's right? if gives Same error... Thanks for your help – MariaEmp Sep 11 '11 at 20:23
  • Ok, I dragged and dropped it to Copy Bundle Resources in xcode 4, but same error :( Don't know what to do now – MariaEmp Sep 11 '11 at 20:45
  • Ok then I have to admit I don't have any more clue :( – AliSoftware Sep 11 '11 at 21:57