Tafkadasoh Tafkadasoh - 1 month ago 59
iOS Question

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, e.g. "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

Answer

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";
Comments