Skip to main content

Could not load nib in bundle on iPhone device


I'm trying to test an app I'm developing on my iPhone. To do that I changed the target from Simulator to Device on Xcode. The application is correctly uploaded to the device and it works, or better, the main view is shown but if I try to open a secondary view, application crash.



On the iPhone log (I installed iPhone configuration utility to see the console [is the only way to see the log from iPhone?]) I can see that error:



"Could not load NIB in bundle"



but, on simulator it works fine. What's wrong? Any idea?



thanks, Andrea


Source: Tips4allCCNA FINAL EXAM

Comments

  1. I've found that sometimes the device is case sensitive and the simulator is not.

    What's the filename of your xib?



    or

    Try uninstalling the app from the simulator and installing it again - the simulator might have an old file left over from a previous run of the app - have you renamed / moved the xib at all during development?

    ReplyDelete
  2. I had a similar problem and was getting the same error. Turns out I was using the full name of the xib file in the attributes panel under "NIB Name:"

    Don't use "SomeViewController.xib", just use "SomeViewController" without the ".xib" extension.

    ReplyDelete
  3. I had the same problem and fixed it like so:


    Open XCode Target
    Click the "Build phases" tab
    Click the "Copy bundle resources" section
    Click the +
    Add the missing Nib file

    ReplyDelete
  4. I had the same problem when invoking initWithNibName:@"MyViewController"

    Changing the invocation to initWithNibName:NSStringFromClass([MyViewController class]) worked well

    ReplyDelete
  5. You can try these things:


    Make sure case is correct
    Use xib filename without the ".xib" extension
    Remove any -(dash) or other special chars, use _(underscore)
    Remove the xib file from the project and add back to the Xcode project
    Check the build settings and make sure deployment is changed to currect SDK

    ReplyDelete
  6. In my case, the xib simply wasn't being copied into the bundle. Once I added the xib into the "Copy Bundle Resources" step for the application target, everything went fine.

    ReplyDelete
  7. I finally managed to solve that issue with these two steps:


    In the view controller files inspector, remove any localization
    (just for testing)
    Ensure that you have checked the correct target membership


    I don't know why it works on the simulator :(

    ReplyDelete
  8. I ran into the same problem. In my case the nib name was "MyViewController.xib" and I renamed it to "MyView.xib". This got rid of the error.

    I was also moving a project from XCode 3 to 4.2. Changing the Path type did not matter.

    ReplyDelete
  9. For what its worth, I received this error when one of my tab bar buttons had the wrong class assigned to it.

    ReplyDelete
  10. I've got it to run with delete all of the localization from the xib
    In the right window.
    Maybe the file is in the localization folder.

    ReplyDelete
  11. I had the same error message.
    My problem, however was that my language settings on my phone were set on "English" and the Region on "United Kingdom". However, the file that could not be loaded was placed in the de.lproj directory.
    Moving the file into the root directory solved it.

    ReplyDelete
  12. I've the same problem. And my solution is remove all Localizations for the view.

    ReplyDelete
  13. I had exactly the behavior you described: works on simulator but get the "Could not load NIB in bundle" when running on the device, and the app remain stuck on the launch image.

    In my case the problem was about the MainWindow.xib file that Xcode automatically created with English localization. I am supporting English and Italian in my app and realized that I was missing the localized version of MainWindow.xib for the Italian language.

    Because I had no need to localize this file (it's Xcode default to create it localized) I fixed the problem by simply removing the English localization, so the same file is used independently of the localization. Another way to fix the problem would be to add the missing localized version, if you need it.

    The app was crashing on the device because my device is configured for Italian language. The simulator instead was set to English and this is why the app run correctly. Just to verify, I set the simulator to Italian language and the app crashed confirming the localization problem.

    ReplyDelete

Post a Comment

Popular posts from this blog

Why is this Javascript much *slower* than its jQuery equivalent?

I have a HTML list of about 500 items and a "filter" box above it. I started by using jQuery to filter the list when I typed a letter (timing code added later): $('#filter').keyup( function() { var jqStart = (new Date).getTime(); var search = $(this).val().toLowerCase(); var $list = $('ul.ablist > li'); $list.each( function() { if ( $(this).text().toLowerCase().indexOf(search) === -1 ) $(this).hide(); else $(this).show(); } ); console.log('Time: ' + ((new Date).getTime() - jqStart)); } ); However, there was a couple of seconds delay after typing each letter (particularly the first letter). So I thought it may be slightly quicker if I used plain Javascript (I read recently that jQuery's each function is particularly slow). Here's my JS equivalent: document.getElementById('filter').addEventListener( 'keyup', function () { var jsStart = (new Date).getTime()...

Is it possible to have IF statement in an Echo statement in PHP

Thanks in advance. I did look at the other questions/answers that were similar and didn't find exactly what I was looking for. I'm trying to do this, am I on the right path? echo " <div id='tabs-".$match."'> <textarea id='".$match."' name='".$match."'>". if ($COLUMN_NAME === $match) { echo $FIELD_WITH_COLUMN_NAME; } else { } ."</textarea> <script type='text/javascript'> CKEDITOR.replace( '".$match."' ); </script> </div>"; I am getting the following error message in the browser: Parse error: syntax error, unexpected T_IF Please let me know if this is the right way to go about nesting an IF statement inside an echo. Thank you.