我正在使用模拟器来测试区域监控。在模拟器中使用 CoreLocation
和区域监控和 Freeway Drive 测试位置路径(调试 > 位置 > Freeway Drive)我能够模拟,至少在视觉上模拟 Freeway Drive 的路径,因为它与各种叠加。一旦我开始监视用户的位置,这些叠加层就会转换为区域并进行监视。无论如何,这似乎不太好用。当您“认为”时,我的叠加层表示的区域不会导致 didEnter/didExit 事件。这些区域的大小似乎比我指定的距离宽得多。我猜这是因为系统应用了缓冲。
Apple 的 Region Monitoring documentation声明:
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.
文档似乎没有准确说明这个缓冲垫是什么。也不知道是怎么计算的。有谁知道系统定义的缓冲垫是什么?
我认为是 200m。在 Region Monitoring 文档的底部有一段粗略地解释了如何测试:
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.
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.
关于ios - 什么是 CoreLocation 的区域监控系统定义的缓冲垫?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21297021/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |