Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 359
Tafkadasoh Avatar asked Sep 24 '12 11:09

Tafkadasoh


People also ask

How do you localize a string inside the iOS Info plist file?

To do this, go to File->New->File , choose Strings File under Resource tab of iOS , name it InfoPlist , and create.

What is the use of info plist in iOS?

The Info. plist file contains critical information about the configuration of an iOS mobile app—such as iOS versions that are supported and device compatibility—which the operating system uses to interact with the app. This file is automatically created when the mobile app is compiled.


1 Answers

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"; 
like image 193
Gerhard Klauser Avatar answered Sep 30 '22 18:09

Gerhard Klauser