Could not load NIB in bundle: 'NSBundle'

45,403

Solution 1

One of your NIB file is missing from project, add the required NIB file:

In Build Phases

  1. expand Copy Bundle Resources
  2. click + at bottom
  3. add the required NIB file.

Clean your build by Shift+Cmd+K, then run.

P.S. Also make sure to use exact spelling of NIB file while calling initWithNibName:@"ViewNameController"

Probably, you have named your NIB in a call by lowercase letters or you may have also included extension .xib which is not required.

Solution 2

Probably, you have named your NIB in a call by lowercase letters. The simulator works fine in this case, but an iPhone device will return an error during runtime.

For example,

DetailViewController *detailViewController = [[DetailViewController alloc]
            initWithNibName:@"detailViewController" bundle:nil];

will fail. You need to change to:

DetailViewController *detailViewController = [[DetailViewController alloc]
            initWithNibName:@"DetailViewController" bundle:nil];

Solution 3

In your Build Settings, Add Architecture =>> armv6 and armv7

I just removed my error using this

Solution 4

I have got the same problem, but it was because i wrote the extension .xib and it is not neccessary

token_view = [[GetToken alloc] initWithNibName:@"GetToken_iPad.xib" bundle:nil];

instead of

token_view = [[GetToken alloc] initWithNibName:@"GetToken_iPad" bundle:nil];

Solution 5

I Have Same Problem Just Follow Steps.

1.Copy your Project In Another Place.

2.Copy your NIB File Which Crash app.

3.Just Change Name

Ex. Old File Demo.xib Than Copy And Change Name DemoNew.xib

My Code is Below

Old Code

Demo *controller = [[Demo alloc]initWithNibName:@"Demo" bundle:nil];

I Just Change Name

Demo *controller = [[Demo alloc]initWithNibName:@"DemoNew" bundle:nil];

its working for me.

Share:
45,403
James K.
Author by

James K.

Updated on June 30, 2021

Comments

  • James K.
    James K. about 3 years

    What is the error listed below?

    2011-02-23 21:24:12.218 Success[7238:207] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/jimkillen12/Library/Application Support/iPhone Simulator/4.2/Applications/BAA5E0E7-AF12-4301-A4F8-1B9797C9E82D/Success.app> (loaded)' with name 'MainWindow-iPad''

  • James K.
    James K. over 13 years
    Thank you! The only thing that looks different when I open "Get Info" is the file path. The one listed does not look like the one in the NIB error.
  • James K.
    James K. over 13 years
    'NSBundle </Users/jimkillen12/Library/Application Support/iPhone Simulator/4.2/Applications/BAA5E0E7-AF12-4301-A4F8-1B9797C9E‌​82D/Success.app> (loaded)' with name 'MainWindow-iPad'' Instead the file path looks like this: /Users/jimkillen12/Downloads/DailySuccess/MainWindow.xib
  • minovsky
    minovsky almost 12 years
    thanks! everything was indeed running fine on simulator... not sure why it should...
  • Abdalrahman Shatou
    Abdalrahman Shatou over 9 years
    I tried that, but it keeps appearing in red as if the file doesn't exist.
  • Umang Kothari
    Umang Kothari about 8 years
    Its already added, though I am getting error. Can you please explain why?
  • DipakSonara
    DipakSonara over 6 years
    @Denis : You saved my day.