【问题标题】:locationManager didExitRegion never called for iBeaconRegion when monitor regionlocationManager didExitRegion 在监控区域时从未调用 iBeaconRegion
【发布时间】:2021-02-04 17:08:02
【问题描述】:

我已经创建了区域:

let uuid = UUID(uuidString: "04C7E2F3-42A5-5127-B066-502C8A27EB85")! 

beaconRegion = CLBeaconRegion(uuid: uuid, identifier: uuid.uuidString)

并使用终端中的mbeacon 从我的 MacBook 创建信标。

使用 mbeacon 创建信标:screenshot

didRangeBeacons 方法中检测到此信标,当我远离信标时,接近度增加,然后信标消失,但didExitRegion 从未调用。什么时候应该调用这个方法?也许我理解错了。

【问题讨论】:

    标签: swift monitoring core-location region-ranging


    【解决方案1】:

    我检查了 locationManager.monitoredRegions 并在这里看到了不必要的区域。我停止了监控(func stopMonitoring(for region: CLRegion) 或者您可以简单地卸载应用程序并重新安装,因为这将清除监控列表。)对于不必要的区域,didExitRegion 和 didEnterRegion 现在可以工作了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-12
      • 2013-10-25
      • 1970-01-01
      • 1970-01-01
      • 2012-01-25
      相关资源
      最近更新 更多