Build error after I localized Info.plist
Asked Answered
D

2

35

I localized Info.plist :

enter image description here

And I got this build error :

error: could not read data from '/Users/cherif/Apps/Wesh/Info.plist': 
The file “Info.plist” couldn’t be opened because there is no such file.

Actually there are now two Info.plist files :

fr.lproj/Info.plist
Base.lproj/Info.plist

How to localize the Info.plist path ?

Denude answered 22/6, 2015 at 10:59 Comment(6)
Check path of info.plist file in build settingsMattingly
It used to work before localization. After localization there are two Info.plist files. What key-value pair I should change in build settings ?Denude
May be you require to change build settings, I got this kind of issue once when I have moved my info.plist file to another folder. At that time I just used to clean build and clean derived data folder. Cross check that, Is info.plist moved to another folder? and Also check path in Build settings for "info.plist File" key in Targets->Packaging. Generally Its MyProjectName/Info.plistMattingly
@Mattingly I edited the question, there are actually tow Info.plist now, and I guess Xcode is supposed to choose the right one, regarding the langage. How to tell him to do that ?Denude
For localization purpose there should be infoplist.strings file for different languages. I haven't use multiple Info.plist file for localization.Mattingly
To localize info.plist file you can check this #25737200Mattingly
H
40

Roll back those changes, add a InfoPlist.strings file to your project, localize it and then add the needed keys to it. For example:

"CFBundleDisplayName" = "App display name";
"CFBundleName" = "App bundle name";
Heavenward answered 22/6, 2015 at 12:0 Comment(3)
"CFBundleName" is also on .plist or only on .strings file?Sibylsibylla
@Sibylsibylla , On both filesOutofdate
For anyone finding this answer a bit cryptic, check out this #25737200 and the official documentation developer.apple.com/library/content/documentation/General/…Kitkitchen
B
12

To localized Info.plist :

  1. Find in the x-code the folder Resources (is placed in root)
  2. Select the folder Resources
  3. Then press the main menu File->New->File...
  4. Select in section "Resource" Strings File and press Next
  5. Then in Save As field write InfoPlist ONLY ("I" capital and "P" capital)
  6. Then press Create
  7. Then select the file InfoPlist.strings that created in Resources folder and press in the right menu the button "Localize"
  8. Then you Select the Project from the Project Navigator and select the The project from project list
  9. In the info tab at the bottom you can as many as language you want (There is in section Localizations)
  10. The language you can see in Resources Folder
  11. To localize the values ("key") from info.plist file you can open with a text editor and get all the keys you want to localize
  12. You write any key as the example in any InfoPlist.strings like the above example

"NSLocationAlwaysAndWhenInUseUsageDescription"="blabla";

"NSLocationAlwaysUsageDescription"="blabla2";

That's all work and you have localize your info.plist file!

Bus answered 9/3, 2019 at 14:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.