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

查看:15
本文介绍了如何本地化 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

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

推荐答案

将密钥添加到支持文件中本地化的 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天全站免登陆