我本地化Info.plist后生成错误

Che*_*rif 16 xcode localization objective-c ios swift

我本地化了Info.plist:

在此输入图像描述

我得到了这个构建错误:

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.
Run Code Online (Sandbox Code Playgroud)

实际上现在有两个Info.plist文件:

fr.lproj/Info.plist
Base.lproj/Info.plist
Run Code Online (Sandbox Code Playgroud)

如何本地化Info.plist路径?

nce*_*ezo 29

回滚这些更改,将InfoPlist.strings文件添加到项目中,对其进行本地化,然后将所需的键添加到项目中.例如:

"CFBundleDisplayName" = "App display name";
"CFBundleName" = "App bundle name";
Run Code Online (Sandbox Code Playgroud)

  • 对于发现这个答案有点神秘的人,请查看此 /sf/ask/1801569031/ 和官方文档 https ://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html (3认同)

Cos*_*ias 9

本地化 Info.plist :

  1. 在 x-code 中找到文件夹 Resources(放在 root 中)
  2. 选择文件夹资源
  3. 然后按主菜单 File->New->File...
  4. 在“资源”字符串文件部分中选择,然后按下一步
  5. 然后在“另存为”字段中仅写入 InfoPlist(“I”大写和“P”大写)
  6. 然后按创建
  7. 然后选择在 Resources 文件夹中创建的文件 InfoPlist.strings 并在右侧菜单中按“Localize”按钮
  8. 然后从项目导航器中选择项目并从项目列表中选择项目
  9. 在底部的信息选项卡中,您可以使用任意数量的语言(在本地化部分中有)
  10. 您可以在资源文件夹中看到的语言
  11. 要本地化 info.plist 文件中的值(“键”),您可以使用文本编辑器打开并获取要本地化的所有键
  12. 您可以在任何 InfoPlist.strings 中编写任何键作为示例,如上例

"NSLocationAlwaysAndWhenInUseUsageDescription"="blabla";

"NSLocationAlwaysUsageDescription"="blabla2";

这就是全部工作,您已经本地化了 info.plist 文件!