Problems with localization of .storyboard files - ios

Trying to make my project using storyboard.
I changed my info.plist and added entry UIMainStoryboardFile with the name of my storyboard file and other things from documentation. I added new storyboard-file to my project (it was created in Xcode 4.1 and now I'm working with it on 4.2), made interface that i need and decided to localize it.
After adding localizations for it in File Inspector and localizing each file, I don't see any changes when I run the app. Even if i change all localized files, I still see app like it looked before adding localizations in File Inspector. I tried to delete this file and create a new one with another name, but the result was always the same.
When I create a new empty project and do the same thing everything works fine. Or when I remove all localizations for my storyboard-file, everything works too.
What can I do to fix it? What did i miss?
Thanks.

Had the same problem. Solved it by doing a clean, deleting all derived data in filesystem (~/Library/Developer/Xcode/Derived Data) and deleting the App from Simulator.

Related

Why does Xcode say "Duplicate localized resource info.plist found" when I try to import or export localizations?

I'm sure there is something messed up in the project file but I have not been able to find it (it's a legacy project new to me).
If I remove the reference to info.plist in the project, then it will successfully import and export, which is a workaround, but not ideal (obviously, although it's easy to revert).
I have searched for duplicate info.plist files and there are none that I can see (there actually are for the watchkit extension and app, but those are named differently anyway).
The actual name of my info.plist is like myapp-info.plist, but it is correctly named in the build settings--the project builds fine.
I have googled the heck out of this and can't find any other reports so I'm really stuck. Next step is to burn an Apple tech support request and when I do, I'll report back, but I thought I would ask the SO community first.
Thank you!
I had this same error. To fix it, I had to localize the *-info.plist file. Select the info.plist file and click "Localize..." in the File Inspector pane.
I don't know if you have solved this problem but I had the same issue. I think it happens when you change the project name and the build settings do not do its job to reflect the change. The Test info.plist refers to the same target original plist and seems to cause this problem.
Go to build settings in your project>Target>Project-name-Tests>Build Settings. Then locate Packaging>Info.plist File and change the folder to project-nameTest/Info.plist.
I hope this does the trick.
My experience was different here. I have multiple targets that all use the same code base. At some point (ostensibly due to a bad manual merge) the Info.plist setting in the Build Settings tab got set to the same value for multiple targets.
Once I straightened all of those out, I was able to export the Xliff file without any issues.
I was receiving this error message in Xcode 7.3.1 and what I did was create a new empty project in Xcode and model my info.plist files after that. This involved:
renaming my [app name]-Info.plist file to Info.plist and moving it out of Supporting Files to the main folder
going to project target (General tab) and selecting the renamed file. There should be a button for 'Choose Info.plist File'
doing similarly in the Tests folder. I don't think this step is necessary to fix the error but did it for consistency.
I was looking at this question on SO - Duplicate localized resource "/Localizable.strings" found xcode 6.1 - and I was able to export to .xliff successfully when I removed reference to the ProjectName-Info.plist file.
I re-added the file, and the project compiled successfully. You have to remove the reference again every time you want to export/import and re-add the file again.
I wasn't able to import updated .xliff files successfully, but I'm thinking on using just Localizable.strings file moving forward. I'm just happy that Project -> Editor -> Export for localization finally worked!

Xcode 6.1 keeps telling me some PartialInfo.plist couldn't be opened

After I upgraded to Xcode 6.1, it kept throwing this exception when I tried to build my existing application. I tried to remove 'MyController' and add back again. But it would throw the same exception with different controller.
could not read data from '/Users/macbookpro/Library/Developer/Xcode/DerivedData/MyApp-
dmhwkhbfbxprhycwjeunwtbbtsxj/Build/Intermediates/MyApp.build/DEV-iphoneos/MyApp.build/MyController-
PartialInfo.plist': The file “MyController-PartialInfo.plist” couldn’t be opened because there is no
such file.
I found the answer. I have to replace all xib files' IBCocoaTouchPlugin to newer version.
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
You can solve it by deleting the content in the DerivedData folder. If you're worried about deleting too many folders, then delete only the folders that start with the name of your current project that you're trying to problem-solve for.
Remember to close XCode before you delete the data
Library/Developer/Xcode/DerivedData/
For me (with Xcode 6.3) this was happening with a file that happened to end in ~iPhone.xib. I changed it end in the all lower-case ~iphone.xib, and problem solved.
This is generally happens when you open old version xibs
nothing to do only click on the xib in file panel its version will automatically changed/updated with newer version.
so also you not need to remember it.
I encountered this problem when I moved my .plist file to a new folder. You have to go into the Targets list (select the top bar on the left vertical menu of Xcode, the one that has the name of your project, and then select Targets on the vertical menu second from the left) and find the Identity section. From there, select the button that lets you specify the new path of the .plist file.
If that doesn't work, then try deleting your project's folder in ~/Library/Developer/Xcode/DerivedData/ and building again.
Several of you have come up with the partial answer.
I believe this issue is related to Apple's "fix" for when XIBs were loading slowly when they referenced custom fonts. They now store the custom font info in a xibnamePartialInfo.plist file in your derivedData folder.
Now if your app contains xibname~iPhone.xib AND xibname.xib, only the PartialInfo.plist file for xibname~iPhone.xib gets created and you see the error. Opening the xib in InterfaceBuilder had the side-effect of creating this file which is why the problem appeared to go away (until the next clean).
So the solution is to rename all ~iPhone files to something else (dash works as a replacement for tilde). Apparently its the tilde that is hindering the creation of the PartialInfo.plist file for the root XIB
Common answer for most of question... Restart Xcode. It works for me.

xCode won't list storyboard or info.plist for localization

I'm trying to localize an iOS app. According to all the tutorials, one of the first steps is to add localizations to the info pane of the project editor. When I get there, "use base internationalization" isn't checked by default. When I click it, the window "choose files and reference language..." comes up as expected, but it doesn't list any files--i.e. there are no choices for files to localize.
The app builds/runs fine. My storyboard is named "main.storyboard" and is in the project's main folder, so I'm not sure why xCode wouldn't recognize the file.
Of note, the project has gone through a re-naming, and I've been through a couple abortive attempts to localize after adding a language without the base, with the idea of adding the base later. But it looks like that takes me off track, and I had to undo those attempts; in the process, I manually deleted the .lproj folders that had been created.
Any ideas on what the problem is?
Important: Before you do any actions, keep backup of your project folder.
When you select use base internationalization, Xcode will look for User Interface files (Storyboard, Xibs) inside any *.lproj folders in your project. But in your case it won't find any *.lproj folder.
Steps to fix:
Create a "en.lproj" folder next to the storyboard using the Finder.
Then move one UI file like the main.storyboard (or other UI file) into the new folder.
On Xcode, relocate the storyboard file. One way to do it is to remove the old reference to the storyboard file. (will be in red) and re-add it to Xcode.
Now you will see that this file has "English" localization selected.
Retry now the 'use base internationalization' button and it should suggest you to move the main.storyboard to the Base.lproj which it will create for you.

iOS: Localization gone wrong

I'm starting to get confused..I've wanted to finally add my translation file for all strings to my app according to ray wenderlich's tutorial. But somehow now everything got messed up. I removed now every localization again, which deleted my strings file, the storyboard etc. And now I have no localization language set in the project settings and I've copied all files back from the trash.
But my localized string (NSLocalizedString(..)) somehow don't load..or load something else. I've changed some of them to check if my strings file in the project explorer is actually used but it still uses the old strings and I have no idea from where..I've checked the project folder and there aren't any other files.
How can I set up everything again that it works? How can I set the strings file it should use? And how should I set up then the localization, with or without base language?
Edit: And in the simulator I cannot get my app running..it's showing only a black screen. Whereas on my iphone it still works (if I use my iphone from Xcode).
I guess I've deleted all my languages in project settings and now I cannot add any localization anymore :-(
Here's what I would try:
Check your project folder for any leftover .lproj folders / .strings file and delete
Clean / Build
Start localization from scratch following SmoothLocalize's Tutorial
This should delete all old files and create a new default localizable.strings, and then you can add more languages.

iOS validation got Main_iPhone~iphone.storyboardc was not found

I am trying to distribute my iOS app, and I got the following error message during xCode validation.
"storyboard file 'Main_iPhone~iphone.storyboardc' was not found please ensure the specified file is included in the bundle with any required device modifiers appended to the filename". Need some advices...
Remove the storyboard from the plist file if you use iPad
<key>UIMainStoryboardFile</key>
<string>Main</string>
or if you use iPhone
<key>UIMainStoryboardFile~ipad</key>
<string>Main</string>
I solved it by going to Target -> Build Phases -> Copy bundle resources, and add the Main_iPhone.storyboard file.
You can just write the exact name of the storyboard according to apple guidelines default name is :- Main_iPhone.storyboard but i think you can change the name of the storyboard default to 'Main_iPhone~iphone.storyboardc' but they find the default name of storyboard in the bundle.
Thanks, this helped me too.
I modified the ProgramFile-Info.plist under the Supporting Files folder. I found two columns with Main storyboard file base name. I deleted the iPad one that I was getting the error on and then I was able to submit.
Using xCode 6.0.1 I got this error. None of the other solutions listed here fixed it. I resolved it by deleting the storyboard in question from the project (Removing references only -- not moving to trash), then putting it back in via Add Files.
In your Build Phases -> Copy Bundle Resources make sure your main storyboard is included. For example main.storyboard. It will show up red. Some people think that because it's red it should be deleted. But without it, you will get this error when you try to submit to iTunes.
I guess you accidentally deleted a storyboard file. In my case, I solved this like by creating a new storyboard file with a different name. Then copy paste all controllers from Main_iPhone~iphone to this and edit the plist and other places with the new file name. This will work
Editing the plist file solved it for me.
Go to Targets -> Info
To delete a field, hover over the up/down arrow icon next to the key you want to delete, and press the minus.
Or, if you need to add a field, hover over any up/down icon and press the plus.
I had a bug where it was looking for an iPad storyboard, even though I was only targeting iPhones. I simply had to delete the corresponding key/value pair from here.

Resources