Tafkadasoh Tafkadasoh - 4 months ago 118
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?

The new privacy keys are listed at the following link, but the summary column does not list them as being localizable:


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