gpt4 book ai didi

ios - 无法本地化 info.plist 字符串

转载 作者:技术小花猫 更新时间:2023-10-29 10:49:18 25 4
gpt4 key购买 nike

我需要本地化 info.plist 的两个键:NSLocationUsageDescriptionNSCameraUsageDescription。所以我尝试创建一个名为 InfoPlist.strings 的新文件,然后将其本地化,但应用程序始终显示存储在 info.plist 文件中的字符串。怎么了?

来自 Information Property List Key Reference 的官方文档

Localized values are not stored in the Info.plist file itself. Instead, you store the values for a particular localization in a strings file with the name InfoPlist.strings. You place this file in the same language-specific project directory that you use to store other resources for the same localization. The contents of the InfoPlist.strings file are the individual keys you want localized and the appropriately translated value. The routines that look up key values in the Info.plist file take the user’s language preferences into account and return the localized version of the key (from the appropriate InfoPlist.strings file) when one exists. If a localized version of a key does not exist, the routines return the value stored in the Info.plist file.

我的 InfoPlist.strings 文件:

NSCameraUsageDescription = "hello";
NSLocationUsageDescription = "hello hello";

最佳答案

请检查生成的应用程序包,文件是否真的存储在那里,并放在正确的位置。通常这是缺少的步骤。

只需进入项目设置,打开“Build Phases”,看看是否 该文件可以在“Copy Bundle Resources”中找到

关于ios - 无法本地化 info.plist 字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21735999/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com