简体   繁体   English

本地化iOS位置权限提示

[英]Localizing iOS Location Permission Prompt

I have a localized app that needs to request user permission to access the device's location. 我有一个本地化的应用程序,需要请求用户访问设备位置的权限。 Since iOS 8, this requires a message (defined in Info.plist ) stating why the app needs the user's location. 由于iOS 8的,这需要一个消息(定义在Info.plist说明) 为什么应用程序需要用户的位置。 I have localized this message successfully, using this technique . 使用这种技术成功地本地化了这条消息。 I have an InfoPlist.strings file with a foreign-language entry for the key NSLocationWhenInUseUsageDescription : 我有一个InfoPlist.strings文件,其中包含密钥NSLocationWhenInUseUsageDescription的外语条目:

"NSLocationWhenInUseUsageDescription" = "Este aplicativo pode utilizar a sua localização para servir anúncios que são mais relevantes. Sua identidade não é transmitida com a localização.";

This properly localizes the message explaining why the app needs user location. 这正确地定位了消息,解释了应用程序需要用户位置的原因。 But, when iOS shows the alert view containing this message, the title of the alert, and the buttons are not localized: 但是,当iOS显示包含此消息的警报视图时,警报的标题按钮未本地化:

在此输入图像描述

How do I localize the alert's title and button text, too? 如何本地化警报的标题和按钮文本?

I understand how to do all this for a UIAlertView that I show manually, but this alert is shown by the system (iOS). 我知道如何为我手动显示的UIAlertView执行所有这些操作,但系统会显示此警报(iOS)。

Did you test on an actual device? 你在实际设备上测试了吗? I believe the simulator has a bug but it works on real devices. 我相信模拟器有一个bug,但它适用于真实设备。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM