Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
417 views
in Technique[技术] by (71.8m points)

ios - Base internationalization and multiple storyboard not working right

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

enter image description here

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

enter image description here

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 ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...