【问题标题】:Xcode 9 - Warning on Location usage Description in Info.plist - iOS 11Xcode 9 - Info.plist 中关于位置使用说明的警告 - iOS 11
【发布时间】:2017-09-20 06:00:29
【问题描述】:

我刚刚更新到 Xcode 9.0 正式版,当我运行使用定位服务的应用程序时,它运行良好,但控制台打印以下警告:

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

所以我尝试在我的 Info.plist 中添加以下键:

 <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>This app needs your current location</string>

但是当我再次尝试运行该应用程序时,Xcode 9 会显示一条警告:无法读取数据,因为它的格式不正确。

所以我切换回:

<key>NSLocationAlwaysUsageDescription</key>

该应用程序运行良好。哦,我的 Info.plist 已经包含 NSLocationWhenInUseUsageDescription 键!

这是控制台中的 Xcode 9 错误吗?有人收到同样的警告吗?

【问题讨论】:

    标签: ios swift location ios11 xcode9


    【解决方案1】:

    没关系,我通过简单地浏览并在 Info.plist -> 打开为 -> 属性列表视图中选择正确的隐私 - 位置使用选项来修复它,这是插入 Info.plist 的正确键,以备不时之需:

    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>This app needs your current location</string>
    
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>This app needs your current location</string>
    

    【讨论】:

      猜你喜欢
      • 2017-12-15
      • 1970-01-01
      • 2018-03-04
      • 1970-01-01
      • 2018-04-28
      • 1970-01-01
      • 2016-08-26
      • 2021-07-11
      • 1970-01-01
      相关资源
      最近更新 更多