简体   繁体   中英

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. I have localized this message successfully, using this technique . I have an InfoPlist.strings file with a foreign-language entry for the key 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:

在此输入图像描述

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).

Did you test on an actual device? I believe the simulator has a bug but it works on real devices.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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