Reputation: 3932
I'm playing with multiple storyboards and base localization on xCode 4.6. In fact I
I did:
1) edit my project infos localisations: checked "Use Base Internationalization" and added Languages: English, Chinese
2) create a new storyboard called "anotherstoryboard.storyboard"
3) localize my new storyboard (File Inspector / Localize - Localize) using Base internationalization.
4) in my app delegate, I load dynamically my localized storyboard, like this:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"anotherstoryboard" bundle:nil];
case 1: => works
For my new storyboard (step 3) I choose Localization Chinese - Interface Builder Cocoa Touch Storyboard
It works but now I have to maintain localized storyboard, editing them with IB. I don't want such behavior, I just want to use base internationalization and localize .strings files.
case 2: => crashes
For my new storyboard (step 3) I choose Localization Chinese - Localizable Strings
The app crashes saying it can't find my storyboard
'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'anotherstoryboard' in bundle NSBundle </Users/me/Library/Application Support/iPhone Simulator/6.1/Applications/8E036C84-6058-4420-94B4-1726E1F686AD/HelloWorld.app> (loaded)'
What I'm doing wrong ? Why doesn't iOS find the right storyboard in case 2 ?
Upvotes: 16
Views: 23073
Reputation: 39376
If there is a syntax error in your Storyboard.strings file, such as a missing ; or a missing ", there doesn't seem to be any warning (Xcode 10.2.1), and you just don't get any of the localizations in that Storyboard.strings file.
The color of the text doesn't change on the following lines to indicate an issue.
Your best bet is to go through, line-by-line, and make sure there is nothing missing.
Upvotes: 2
Reputation: 646
SOLVED
I have the problem with some arabic translations. I have tried the all possible ways mentioned in post but none worked for me.
Finally i found that my Xcode is not reporting error in string file for my story board! I fixed the issue in string file and my app works as expected !
(Hint: You can also check the console for errors)
Upvotes: 1
Reputation: 840
I had just run into the same issue (again) after starting localizing a new storyboard in Xcode 4.6.2. I checked everything was setup up properly as suggested here and elsewhere, and indeed it was.
For me, the issue was resolved by closing the project in Xcode and manually clearing the Xcode “Derived Data” directory (see Xcode preferences) from the Finder. Then I reopened the project, made a clean build, and voilá, the storyboard got compiled properly and worked as expected.
Upvotes: 15
Reputation: 27373
Base Internationalization is only supported on iOS 6.
I encountered the same problem as you, but worse, because I didn't test on iOS 5. I only knew about this after knowing many of my users experienced crashes.
So, take heed.
There are details on my blog about this. As you already know, xib still works. Therefore, convert all strings to xib (isn't hard at all).
Upvotes: 0
Reputation: 387
I faced the same problem and spend 2 days to resolve it.
Of course I tried all things above, like: cleaning project, reseting Content and Settings in iOS Simulator, deleting all files in /Users/YourUsername/Library/Application Support/iPhone Simulator, deleting all files in /Users/YourUsername/Library/Developer/Xcode/DerivedData, deleting App in iOS device
and nothing helps me to resolve my problem - Storyboard localisation using Base Internationalization + Storyboard.strings doesn't compiles localised Storyboards.
And the reason was that the project previously was targeted for iOS 5.1 but now for iOS 6.1. After changing Project Deployment Target I forgot to change the Compiling settings in storyboard.
What helps me - just change "Builds for" to at least "iOS6.1 and Later" in File Inspector of your storyboard.
Upvotes: 1
Reputation: 3226
Since this was a warning and not an error, I didn’t think it would be a problem at first, but eventually it was my only load. In the right sidebar, leftmost option (the icon that looks like a document), I saw a Localization section with two checkboxes, Base and English. Base was checked and English unchecked.
Instead, I checked English, then changed the dropdown to Interface Builder. Then I unchecked Base.
When I checked the Build Rule again, Main.storyboard was no longer red. And when I tried to run the app in the 5.1 simulator again, it came up just fine. Note: just checking English/Interface Builder is enough to get the app to run in iOS 5.1, but then you’ll run into an issue where updates to the Storyboard won’t be reflected. You need to uncheck Base so that English is the only version of the storyboard there is; that way updates will always be reflected as soon as you rerun.
Upvotes: 0
Reputation: 17902
I fixed the issue by dragging my story board into finder, then deleting the one in the Xcode side panel, then re-adding the one I originally dragged to finder back into the Xcode side panel. THEN removing the old RED storyboard file in "copy bundle resources" and adding the new one manually by dragging it in.
Upvotes: 2
Reputation: 6052
Click on the project inside the Project Navigator
, select your project and select Info
at the top. Next you have to deselect Use Base Internationalization
and click "Remove".
Upvotes: 3
Reputation: 1546
Inside the storyboard localization settings, try remove the check next to the 'Base' option. It's not supported under iOS6
Upvotes: 0
Reputation: 1101
I tried exactly the same as you and I can say that this error will happen as you have shown.
The solution is to remove and add your storyboard file from your targets build phases. Therefore, click on your target like shown in the image
Then remove the storyboard file from build phases and add it again.
This worked for me!
Upvotes: 2
Reputation: 8247
You get this error because for iOS 6 (which is required for Base Internationalization) the storyboard file gets compiled into a storyboardc file. Also it copies the strings files belonging to it to the target. Thus on an iOS 6 device there IS no .storyboard file.
To get a storyboard file compiled you need to make sure that is in the Copy Bundle Resources build phase. Then the storyboard compiler (see build rules) kicks in and should compile it. If not, then this is a bug and you should report it.
Upvotes: 3