Failed to load bundled thread on iPhone

I am trying to test the application that I am developing on my iPhone. To do this, I changed the target from Simulator to Device to Xcode. The application is correctly downloaded to the device and it works. The main view is displayed, but if I try to open the secondary view, the application crashes.

In the iPhone log (I installed the iPhone configuration utility to see the console [is this the only way to see the log from the iPhone?]). I see this error:

Could not load NIB in bundle 

But on the simulator, it works fine. What's wrong? Any ideas?

+25
iphone ios4
Nov 11 2018-10-11
source share
16 answers

I found that sometimes the device is case sensitive, but the simulator is not.

What is the name of your xib file?




or

Try to remove the application from the simulator and install it again - the simulator may have an old file left after the previous application launch - did you rename / transfer xib at all during development?

+22
Nov 11 2018-10-11
source share

I had the same problem and fixed it like this:

  • Open Xcode Target
  • Go to the Build Phases tab
  • Click the "Copy package resources" section
  • Press the + button
  • Add Missing Nib File
+62
Apr 01 '12 at 11:15
source share

I had a similar problem and was getting the same error. Turns out I used the fully qualified xib file name in the attribute panel in the "NIB Name:" section

Do not use "SomeViewController.xib", just use "SomeViewController" without the extension ".xib".

+18
Apr 16 '11 at 1:30
source share

I had the same problem when calling initWithNibName:@"MyViewController"

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

+9
Feb 05 '11 at 19:53
source share

You can try the following:

  • Make sure the case is correct.
  • Use xib file name without .xib extension.
  • Remove any (dashes) or other special characters, use _ (underscore)
  • Delete the xib file from the project and add it back to the Xcode project
  • Check your build settings and make sure the deployment is modified to correct the SDK
+9
Jun 17 2018-11-11T00:
source share

In my case, xib just didn't copy to the bunch. As soon as I added xib to the โ€œCopy Bundle Resourcesโ€ for the target application, everything went fine.

+5
Aug 02 2018-11-11T00:
source share

I managed to solve this problem with these two steps:

  • In the view controller file manager, delete any localization (for testing only)
  • Make sure you verify the correct target membership.

I do not know why it works on the simulator :(

+3
Aug 25 '11 at 16:17
source share

I ran into the same problem. In my case, the nib name was "MyViewController.xib" and I renamed it to "MyView.xib". This eliminated the error.

I also moved the project from Xcode 3 to 4.2. Changing the type of Path didn't matter.

+2
Jun 30 2018-11-11T00:
source share

I had the same error message. My problem, however, was that my language settings on my phone were set to "English" and in the "United Kingdom" region. However, a file that could not be downloaded was placed in the de.lproj directory. Moving the file to the root directory allowed it.

+2
Oct 19 '11 at 16:03
source share

For me, the problem was exactly what FreeAsInBeer said: for some reason, the nickname did not disappear from the kit, whereas it was there earlier and worked correctly in previous versions of the application.

To fix the problem, I did the following:

  • Select a project in the Project Navigator.
  • In the project settings, select Build Phases .
  • Expand Resources copy resources .
  • Scroll down (if necessary) and press the + button.
  • In the dialog that appears, click the Add another ... button.
  • Locate the missing .XIB file in the file system.
  • Build and run ... at startup, a missing icon should appear.

This is what worked for me when I received this message. Your mileage may vary, as circumstances are not always the same for everyone, but I hope this helps someone who is facing this problem.

-Evan

+2
Nov 07. '12 at 17:07
source share

A simple error that can cause this error is an attempt to initWithNibName on an imported viewController when you use a storyboard, not separate Nib files. If so, then just start the controller instead of trying to initialize with anything that does not exist, or run these fields with nil.

If the Storyboard and no nib, change initWithNibName: bundle: just init or initWithNibName: nil bundle: nil

+2
May 23 '13 at 17:42
source share

For what it's worth, I got this error when one of the buttons on the tab bar was assigned the wrong class.

+1
Mar 18 2018-11-11T00:
source share

I need to run it with the removal of all localization from xib in the right window. The file may be located in the localization folder.

+1
Jul 22 '11 at 17:13
source share

I have the same problem. And my solution is to remove all localizations for the view.

+1
Feb 08 '12 at 11:28
source share

I had exactly the behavior that you described: it works on the simulator, but when it starts on the device, "Unable to load NIB in the bundle" is loaded, and the application remains shot in the launch snapshot.

In my case, the problem was in the MainWindow.xib file, which Xcode automatically created with English localization. I support English and Italian in my application and realized that I am missing a localized version of MainWindow.xib for the Italian language.

Since I did not need to localize this file (it became Xcode by default for its localization), I fixed the problem by simply deleting English localization, so the same file is used regardless of the localization. Another way to fix the problem is to add the missing localized version if you need it.

The application crashes on the device because my device is configured in Italian. Instead, the simulator was installed in English, and therefore the application works correctly. Just to check, I installed the simulator in Italian, and the application crashed, confirming the localization problem.

+1
Feb 08 '12 at 22:50
source share

I also had this problem when I loaded the child view controller from initWithCoder, which is a good place to initialize, but keep in mind that you should add it as the actual child AFTER loading the view.

So slide something like this:

 [self addChildViewController: self.pageViewController]; [self.view addSubview: self.pageViewController.view]; [self.pageViewController didMoveToParentViewController:self]; 

... from your init method and to viewDidLoad. Do not say that this is your problem in particular, but it may be useful to others.

+1
Oct 07 '12 at 20:50
source share



All Articles