Suryakant Sharma
Suryakant Sharma

Reputation: 3960

App crashes with NSInternalInconsistencyException', reason: 'Could not load NIB in bundle'

Everyone I'm working on a iOS Static Library. when I use this static library in sample app and run it, it crashes with below exception...

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/name/Library/Developer/CoreSimulator/Devices/D982246E-72D6-482F-8E1C-AE3D1BF37607/data/Containers/Bundle/Application/016193F2-36A3-492D-8E7B-CE560FACCF6D/TestApp.app> (loaded)' with name 'OptionsViewController''
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000107385c65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010701ebb7 objc_exception_throw + 45
    2   CoreFoundation                      0x0000000107385b9d +[NSException raise:format:] + 205
    3   UIKit                               0x0000000107d30171 -[UINib instantiateWithOwner:options:] + 552
    4   UIKit                               0x0000000107b88718 -[UIViewController _loadViewFromNibNamed:bundle:] + 242
    5   UIKit                               0x0000000107b88d08 -[UIViewController loadView] + 109
    6   UIKit                               0x0000000107b88f79 -[UIViewController loadViewIfRequired] + 75
    7   UIKit                               0x0000000107b8940e -[UIViewController view] + 27
    8   UIKit                               0x0000000107bae297 -[UINavigationController _startCustomTransition:] + 633
    9   UIKit                               0x0000000107bba3bf -[UINavigationController _startDeferredTransitionIfNeeded:] + 386
    10  UIKit                               0x0000000107bbaf0e -[UINavigationController __viewWillLayoutSubviews] + 43
    11  UIKit                               0x0000000107d05715 -[UILayoutContainerView layoutSubviews] + 202
    12  UIKit                               0x0000000107ad8a2b -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 536
    13  QuartzCore                          0x000000010bcbeec2 -[CALayer layoutSublayers] + 146
    14  QuartzCore                          0x000000010bcb36d6 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
    15  QuartzCore                          0x000000010bcb3546 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
    16  QuartzCore                          0x000000010bc1f886 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242
    17  QuartzCore                          0x000000010bc20a3a _ZN2CA11Transaction6commitEv + 462
    18  QuartzCore                          0x000000010bc210eb _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 89
    19  CoreFoundation                      0x00000001072b8ca7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    20  CoreFoundation                      0x00000001072b8c00 __CFRunLoopDoObservers + 368
    21  CoreFoundation                      0x00000001072aea33 __CFRunLoopRun + 1123
    22  CoreFoundation                      0x00000001072ae366 CFRunLoopRunSpecific + 470
    23  GraphicsServices                    0x000000010b7e7a3e GSEventRunModal + 161
    24  UIKit                               0x0000000107a58900 UIApplicationMain + 1282
    25  TestApp                0x0000000106a54bcf main + 111
    26  libdyld.dylib                       0x0000000109b7f145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

I know, generally this error mean that OptionsViewController xib file is not been included in this library/project but guess what? OptionsViewController's .m file present in compile Sources and .h and .xib file present there in copy files of Build Phases of library.

This library was working file with Xcode 6.1. The time I install Xcode 6.3. this crash came in to picture, now it is not working even in Xcode 6.1

Now I'm clueless why my sample app keep crashing. It has been 1 whole day, I have been struggling with this particular issue without any luck.

Any guidance, clue, anything would be highly appreciated.

UPDATE

App not able to find Resources, files, anything from Static Library. I have to include all .h , .xibs and resources files in to build face of sample app to make it work, which is not a right way to do it I feel.

Upvotes: 0

Views: 435

Answers (1)

johnpatrickmorgan
johnpatrickmorgan

Reputation: 2372

Try [[OptionsViewController alloc] initWithNibName:@"OptionsViewController" bundle:[NSBundle bundleForClass:[OptionsViewController class]]]; instead.

Upvotes: 1

Related Questions