简体   繁体   中英

How to localize iOS 6 new Info.plist Privacy purpose strings?

Apple introduced new Privacy settings per app, allowing users to decide if an app is allowed to access the user's Contacts, Calendar, Photos, and Reminders. The user will see an UIAlertView when an app first tries to access one of these resources, similar to the known mechanism when an app wants location access.

It's also possible to set purpose strings, to let the user know why the app wants access. However, this is now done through keys in Info.plist, eg "Privacy - Contacts Usage description" (NSContactsUsageDescription) for Contacts.

Now I ask myself how can I localize these values? For the location purpose text, I used to set the purpose property of an CLLocationManager instance with NSLocalizedString(...). How do I do something similar with those new keys in Info.plist?

Addendum: The new privacy keys are listed at the following link, but the summary column does not list them as being localizable: https://developer.apple.com/library/mac/#documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW14

Add the key to the localized InfoPlist.strings in the supporting files. It should look like this for the purpose:

/* Localized version of location services purpose for Info.plist */
NSLocationUsageDescription = "here is your purpose to use location service";

您可以通过本地化InfoPlist.strings文件来本地化您的Info.plist。

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