I have localized my ContactView.xib file into English and French and it normally has to be loaded automatically. I use the initWithNibName: bundle:
method of UIViewController to initialize the object, but the result is always the same: the file loaded is the English one!
I've cleaned the project, reinstalled the app and so on, but nothing works, the French version of my xib file is simply ignored!
I know there is a related post (here) but the problem isn't exactly the same, it's persistent despite my efforts.
Here is a sample of the code I've written :
- (id)initWithNibName:(NSString *)开发者_JAVA百科nibNameOrNil bundle:(NSBundle *)nibBundleOrNil contact:(Contact *)aContact
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self != nil)
{
self.contact = aContact;
}
return self;
}
Is there anything else to do to load the file in the appropriate locale? I've checked the preferences on the device (or simulator) and the one loaded in the module and the locale is at each time set to french.
Thank you in advance,
Geoffroy.
I had a very similar issue today and wasted about 2 hours on it.
At the end I deleted the localized xib through the "-" in the localization menu. Then I had to delete the .XIB file in the project
(be sure to have a save copy of it somewhere before deleting anything - you can't get it back!!).
Then I dragged the .XIB file back into the project. And finally it worked
AFter all that I could localize correctly and it worked. But let me tell you, I will NEVER EVER start to localize before the app is not 200% ready. There seems to be a serious bug in xCode4. (It even crashed on me couple of times - I guess because it kept a link to some xib that couldn't be found anywhere on the HDD.
This error only went away after the described procedure. Even deleting the .XIB file from the project and deleting it from the HDD still didn't help. XCode happily started with this one .XIB (wherever it got it from).
Good luck! (I wasted too much time on this today!)
For reference, I think I figured out what is causing this problem:
Did you localize your French version as "Strings" file? If so, try this:
Select the .xib (the root entry, not a localized version)
In the inspector, check: Interface Builder Document → Document Editing → Builds for
In my case, it said "OS X 10.7 and later" and I ran into the same problem. I set it to "OS X 10.10" and after another clean build, everything works.
I suspect your French localization was not loaded, because the .xib file format was not yet compatible with the .strings localization (I don't quite recall when this was introduced).
精彩评论