如何本地化iOS 6新的Info.plist隐私目的字符串? [英] How to localize iOS 6 new Info.plist Privacy purpose strings?

查看:186
本文介绍了如何本地化iOS 6新的Info.plist隐私目的字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Apple为每个应用程序引入了新的隐私设置,允许用户决定是否允许应用访问用户的联系人,日历,照片和提醒。当应用程序首次尝试访问其中一个资源时,用户将看到UIAlertView,类似于应用程序想要访问位置时的已知机制。

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.

也可以设置目的字符串,让用户知道应用程序想要访问的原因。但是,现在通过Info.plist中的键完成此操作,例如,联系人的隐私 - 联系人使用说明(NSContactsUsageDescription)。

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.

现在我问自己如何本地化这些值?对于位置目的文本,我曾经使用NSLocalizedString(...)设置CLLocationManager实例的目的属性。如何使用Info.plist中的新密钥执行类似操作?

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?

附录:
新的隐私密钥列在以下链接中,但摘要列不会将它们列为可本地化:
https://developer.apple.com/library/mac/#documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW14

推荐答案

将密钥添加到本地化的 InfoPlist.strings 在支持文件中。
它应该看起来像这样:

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

这篇关于如何本地化iOS 6新的Info.plist隐私目的字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆