Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xib not found after localization

I've added a new localization for italian language in my project and after that I localized a xib file to start the translation of the project. The problem is, now when I run my project in the simulator, none of the xibs are found.

(GAIUncaughtExceptionHandler.m:41): Uncaught exception: Could not load NIB in bundle: 'NSBundle ...

I'm instantiating the file owner of this xib using initWithNibName.

I've tried both pure localization of the xib and the base localization, but none of them are working.

I'm initializing the owner like this:

[[SPConfigViewController alloc] initWithNibName:@"SPConfigViewController" bundle:nil];

EDIT:

After I created the localized version of the xib, I decided to just close XCode and open it again, and it worked...

like image 458
MouseCaneta Avatar asked Apr 16 '13 18:04

MouseCaneta


People also ask

How do I localize Xib files?

strings files from the xib, which make localization pretty straight forward. Right click on the xib file in Xcode, and choose Get Info . Select the General tab and on the bottom click Make File Localizable . Then you will be able to add localizations by clicking Add Localization on that same tab.

What is difference between XIB and NIB?

In fact, the acronym "NIB" comes from "NeXTSTEP Interface Builder", and "XIB" from "Xcode Interface Builder". NIBs and XIBs are effectively the same thing: XIBs are newer and are used while you're developing, whereas NIBs are what get produced when you create a build.


1 Answers

I had the same experience and what a mind trip...

Process:

(Assumes a project that has chosen "Use Base Internationalization" in the Project's Info)

  1. Click on a .xib resource in the File Navigator, which loads Interface Builder
  2. Using the File Inspector, click the Localize button
  3. A modal presents asking which language you would like to use ("Base" was unavailable to me, so I picked "English")
  4. Now in the Localized section of the File Inspector a checkmark is next to English and none next to Base, so I checked Base
  5. Then I was given a picker for how I wanted English to be localized: Interface Builder Cocoa Touch XIB or Localizable Strings

Okay, I was optimistic that this would work, so run...
... and crash

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle < /var/mobile/Applications/_____/_____.app> (loaded)' with name '__MY NIB STRING HERE___''

Clean, Build, Run -> Crash
Option Key + Clean, Build, Run -> Crash
Option Key + Clean, Delete App, Build, Run -> Crash
Option Key + Clean, Reset Simulator, Curse, Build, Run -> Crash

Quit Xcode, Relaunch Xcode, Build, Run -> Works! WTF.

I've opened a Bug Report against the issues and would appreciate if you run into this problem that you would duplicate it so the developer tools team knows its a reoccurring issue.

like image 187
edelaney05 Avatar answered Oct 17 '22 11:10

edelaney05