【问题标题】:How can I resolve 'allowsBackgroundLocationUpdates' error in flutter如何解决颤振中的“allowsBackgroundLocationUpdates”错误
【发布时间】:2021-07-11 05:48:48
【问题描述】:

我在运行 Flutter 应用时遇到了一些与位置设置相关的错误。

错误 1:

/Users/mustafazaki/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/location-3.2.4/ios/Classes/LocationPlugin.m:84:43: 注意:将“allowsBackgroundLocationUpdates”包含在@available 检查中 让这个警告静音 结果(self.clLocationManager.allowsBackgroundLocationUpdates?@1: @0);

错误 2:

/Users/mustafazaki/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/location-3.2.4/ios/Classes/LocationPlugin.m:91:36: 警告:“setAllowsBackgroundLocationUpdates:”仅适用于 iOS 9.0 或更新版本 [-Wunguarded-availability] self.clLocationManager.allowsBackgroundLocationUpdates = 启用;

错误 3:

/Users/mustafazaki/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/location-3.2.4/ios/Classes/LocationPlugin.m:92:36: 注意:将 'setShowsBackgroundLocationIndicator:' 包含在 @available 中 检查以使此警告静音 self.clLocationManager.showsBackgroundLocationIndicator = enable;

【问题讨论】:

    标签: ios flutter dart ios9


    【解决方案1】:

    尝试将此代码添加到您的info.plist at ios->Runner->Info.plist inside <dict> 标签。

    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>Location permission</string>
    <key>NSLocationAlwaysUsageDescription</key>
    <string>Location permission</string>
    <key>NSLocationUsageDescription</key>
    <string>Location permission</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>Location permission</string>
    

    停止您的应用,然后在终端中运行:

    1. 扑干净
    2. 颤振酒吧获取
    3. 颤动运行

    【讨论】:

      猜你喜欢
      • 2020-12-16
      • 2021-11-05
      • 2021-05-12
      • 2021-09-17
      • 2021-05-02
      • 2023-02-16
      • 2021-10-26
      • 1970-01-01
      • 2021-08-14
      相关资源
      最近更新 更多