Cocoa failed to load nib window file while nib localization

I am trying to create and show a new window in my simple Cocoa application:

myWindow = [[MyWindowController alloc] initWithWindowNibName:@"MyWindow" owner:self]; [myWindow showWindow:self]; 

It works well with the base nib file without localization, but as soon as I turn on localization for this specific nib file (using the Xcode โ€œlocalizeโ€ option available to validate the form file), the application gives me this error when executing the code above

- [MyWindowController loadWindow]: Failed to load nib window file 'AuthWindow'.

Should I change the way my window controller initializes when using localized handpieces? It fails only when the nib containing the window is localized (with only one language - in English), when the localization is not configured - the window is loaded and displayed on the screen as it should. I canโ€™t find the right answer, I'm new to Cocoa on OSX, but have some experience with CocoaTouch and iOS development.

+4
source share
4 answers

I restarted Xcode and the error went away ...

I donโ€™t know ... but what would ...

+8
source

initWithWindowNibName: can find the .nib file in the localization directory, for example en.lproj/ . The problem is that sometimes Xcode forgets to compile the .xib file (the Interface Builder file in the XML format that you usually play) into a .nib file or binary format - especially when the .xib file is simply localized by clicking the Localized ... "

If you open $build_dir/Your.app/Contents/Resources/$locale.lproj , you will see that some xibs are only copied from the source directory.

Restarting Xcode will solve the situation, while I'm not sure what the reason is and why the restart does the trick.

+6
source

This is an old question, but I found a different solution than the ones above. For the issue in question, go to the identity panel and verify that the target nib membership is verified.

enter image description here

+3
source

I had such a mistake. For me, it decided to backup the xib file, delete it from xcode, restart xcode and then add it back. Go figure ...

0
source

Source: https://habr.com/ru/post/1483593/


All Articles