Is there any way to use Localizable.strings with NSLocalizedString(@"KEY", @"") in xCode 4.5 for iOS6 like in older iOS5?
Here is my sample code:
In Localizable.strings
"KEY" = "Hello World!";
In .m script
NSString *tempString = NSLocalizedString(@"KEY", NULL);
NSLog(@"My String is: %@", tempString);
The log for iOS5.1 is: "My String is: Hello World!"
The log for iOS6 is: "My String is: KEY"
...I'm really going to become crazy! Where is my error?
Thanks a lot!!!
问题:
回答1:
Their is no need to create a new project and copy, just delete the localizable files, create it once again and you will be fine.
回答2:
The localized strings in my current app still work in iO6. I typically just use NSLocalizedString(@"KEY", NULL); Are you sure yours is working properly for 5.1?
回答3:
Look at answer for post: IOS String Localization stops working when adding additional localization
It works for me. Clean build + remove from simulator (or phone) fix the error.
回答4:
The only solution I have found is:
- restart with a new project from xCode template
- enable Localization for at least 2 languages
- drag inside all old files from corrupted project
- copy the contend of old storyboards into new ones
- do frequent snapshots just in case of necessity
I really don't know where was the problem, but now all works again well as usual.
回答5:
Change the language settings of simulator.
回答6:
I was missing a semi-colon at the end of a line in one of my string-files. The compiler didn't report it even when I cleaned the project at built it again. First after restarting XCode the error was reported and I could find it and fix it.