无法在 info.plist - Xcode 9 Beta 中添加 "Privacy - Location Always and When in use usage description"
Not able to add "Privacy - Location Always and When in use usage description" in info.plist - Xcode 9 Beta
我在 Xcode 9 Beta 中尝试向用户请求位置许可时出现以下错误。我尝试在 info.plist 中添加 "Privacy - Location When In Use Usage Description" 和 "Privacy - Location Usage Description" 描述,但仍然出现相同的错误。
This app has attempted to access privacy-sensitive data without a
usage description. The app's Info.plist must contain both
NSLocationAlwaysAndWhenInUseUsageDescription and
NSLocationWhenInUseUsageDescription keys with string values explaining
to the user how the app uses this data
当我尝试添加 "Privacy - Location Always and When in use usage description" 时,它会自动重命名为 "Privacy - Location Usage Description" in info.plist
添加“NSLocationAlwaysAndWhenInUseUsageDescription”而不是“隐私 - 位置始终和使用时间描述”。在当前的测试版中,它不会重命名为任何内容,但它会显示 iOS 11.
的正确对话框
基本上它说您需要在应用的 Info.plist 文件中包含 NSLocationWhenInUseUsageDescription 和 NSLocationAlwaysAndWhenInUsageDescription 键。 (如果您的应用支持 iOS 10 及更早版本,则还需要 NSLocationAlwaysUsageDescription 密钥。)如果这些密钥不存在,授权请求会立即失败。
我目前正在使用 Xcode 版本 9.0 beta 5 (9M202q),它可以正常工作。
重要提示:是
NSLocationAlwaysAndWhenInUseUsageDescription
、
不是
NSLocationAlwaysAndWhenInUsageDescription
。
Apple 在他们的 Request Always Authorization 指南中打错了字 (最后一次访问:2017 年 9 月 20 日)。
你需要这样添加NSLocationAlwaysAndWhenInUseUsageDescriptioninInfo.plist
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>App_Name requires user’s location for better user experience.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>App_Name requires user’s location for better user experience.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>App_Name requires user’s location for better user experience.</string>
请注意,这不是汉斯建议的打字错误,而是正确的。设置的格式令人困惑,但符合
之类的格式
"[APIModule][设置][KeyType]"
所以设置的模块是应用程序的 "NSLocation" 调用,设置是关于用户位置首选项的 "Always and When in Use" 设置,KeyType 是 "Usage Description" 因此结果键是
NSLocationAlwaysAndWhenInUseUsageDescription
或拆分成复合词:
NSLocation
AlwaysAndWhenInUse
UsageDescription
我在 Xcode 9 Beta 中尝试向用户请求位置许可时出现以下错误。我尝试在 info.plist 中添加 "Privacy - Location When In Use Usage Description" 和 "Privacy - Location Usage Description" 描述,但仍然出现相同的错误。
This app has attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain both NSLocationAlwaysAndWhenInUseUsageDescription and NSLocationWhenInUseUsageDescription keys with string values explaining to the user how the app uses this data
当我尝试添加 "Privacy - Location Always and When in use usage description" 时,它会自动重命名为 "Privacy - Location Usage Description" in info.plist
添加“NSLocationAlwaysAndWhenInUseUsageDescription”而不是“隐私 - 位置始终和使用时间描述”。在当前的测试版中,它不会重命名为任何内容,但它会显示 iOS 11.
的正确对话框基本上它说您需要在应用的 Info.plist 文件中包含 NSLocationWhenInUseUsageDescription 和 NSLocationAlwaysAndWhenInUsageDescription 键。 (如果您的应用支持 iOS 10 及更早版本,则还需要 NSLocationAlwaysUsageDescription 密钥。)如果这些密钥不存在,授权请求会立即失败。
我目前正在使用 Xcode 版本 9.0 beta 5 (9M202q),它可以正常工作。
重要提示:是
NSLocationAlwaysAndWhenInUseUsageDescription
、
不是
NSLocationAlwaysAndWhenInUsageDescription
。
Apple 在他们的 Request Always Authorization 指南中打错了字 (最后一次访问:2017 年 9 月 20 日)。
你需要这样添加NSLocationAlwaysAndWhenInUseUsageDescriptioninInfo.plist
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>App_Name requires user’s location for better user experience.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>App_Name requires user’s location for better user experience.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>App_Name requires user’s location for better user experience.</string>
请注意,这不是汉斯建议的打字错误,而是正确的。设置的格式令人困惑,但符合
之类的格式"[APIModule][设置][KeyType]"
所以设置的模块是应用程序的 "NSLocation" 调用,设置是关于用户位置首选项的 "Always and When in Use" 设置,KeyType 是 "Usage Description" 因此结果键是
NSLocationAlwaysAndWhenInUseUsageDescription
或拆分成复合词:
NSLocation
AlwaysAndWhenInUse
UsageDescription