什么是CoreLocation的“区域监视"系统定义的缓冲? [英] What is CoreLocation's Region Monitoring system defined cushion?

查看:95
本文介绍了什么是CoreLocation的“区域监视"系统定义的缓冲?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用模拟器来测试区域监视.在模拟器中使用CoreLocation进行区域监视和Freeway Drive测试位置路径(调试">位置">"Freeway Drive"),我可以至少在视觉上模拟Freeway Drive与各种叠加层相交时的路径.一旦我开始监视用户的位置,这些叠加层就会转换为区域并受到监视.无论如何,这似乎效果不佳.当您认为"它们时,由我的叠加层表示的区域不会引起didEnter/didExit事件.这些区域的大小似乎比我指定的距离宽得多.我猜这是因为系统需要缓冲.

I'm using the simulator to test region monitoring. Using CoreLocation with region monitoring and the Freeway Drive test location path in the Simulator (Debug > Location > Freeway Drive) I'm able to simulate, at least visually the path of the Freeway Drive as it intersects with various overlays. Those overlays are converted to regions and monitored as soon as I start monitoring the user's location. Anyway, this doesn't seem to work very well. The regions represented by my overlays don't cause didEnter/didExit events when you "think" they would. The regions seem to be much wider in size than the distances I specified. I'm guess this is because of the cushion the system applies.

Apple的区域监视文档指出:

直到边界加系统定义的缓冲距离之前,系统不会报告边界交叉.该缓冲值可防止系统在用户靠近边界边缘旅行时快速连续生成大量进入和退出事件.

The system does not report boundary crossings until the boundary plus a system-defined cushion distance is exceeded. This cushion value prevents the system from generating numerous entered and exited events in quick succession while the user is traveling close the edge of the boundary.

文档似乎并没有确切说明这个缓冲是什么.也不怎么计算.有谁知道系统定义的缓冲是什么?

The docs don't seem to state what this cushion is, exactly. Nor how it is calculated. Does anyone know what the system defined cushion is?

推荐答案

我认为是200m.在区域监视"文档的底部,有一段简短地解释了如何进行测试:

I think it's 200m. At the bottom of the Region Monitoring documentation there's a paragraph that loosely explains how to test:

在iOS模拟器或设备上测试区域监视代码时,请注意,跨越区域边界后可能不会立即发生区域事件.为了防止虚假通知,iOS在满足特定阈值条件之前不会传递区域通知.具体来说,用户的位置必须越过区域边界并远离该边界最小距离,并在报告通知之前至少保持20秒钟的最小距离.

When testing your region monitoring code in iOS Simulator or on a device, realize that region events may not happen immediately after a region boundary is crossed. To prevent spurious notifications, iOS does not deliver region notifications until certain threshold conditions are met. Specifically, the user’s location must cross the region boundary and move away from that boundary by a minimum distance and remain at that minimum distance for at least 20 seconds before the notifications are reported.

特定阈值距离由当前可用的硬件和定位技术确定.例如,如果禁用了Wi-Fi,则区域监视的准确性会大大降低. 但是,出于测试目的,您可以假定最小距离约为200米.

The specific threshold distances are determined by the hardware and the location technologies that are currently available. For example, if Wi-Fi is disabled, region monitoring is significantly less accurate. However, for testing purposes, you can assume that the minimum distance is approximately 200 meters.

这篇关于什么是CoreLocation的“区域监视"系统定义的缓冲?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆