菜鸟教程小白 发表于 2022-12-13 06:00:56

ios - 什么是 CoreLocation 的区域监控系统定义的缓冲垫?


                                            <p><p>我正在使用模拟器来测试区域监控。在模拟器中使用 <code>CoreLocation</code> 和区域监控和 Freeway Drive 测试位置路径(调试 > 位置 > Freeway Drive)我能够模拟,至少在视觉上模拟 Freeway Drive 的路径,因为它与各种叠加。一旦我开始监视用户的位置,这些叠加层就会转换为区域并进行监视。无论如何,这似乎不太好用。当您“认为”时,我的叠加层表示的区域不会导致 didEnter/didExit 事件。这些区域的大小似乎比我指定的距离宽得多。我猜这是因为系统应用了缓冲。</p>

<p>Apple 的 <a href="https://developer.apple.com/library/ios/documentation/userexperience/conceptual/LocationAwarenessPG/RegionMonitoring/RegionMonitoring.html" rel="noreferrer noopener nofollow">Region Monitoring documentation</a>声明:</p>

<blockquote>
<p>The system does not report boundary crossings until the boundary plus a <strong>system-defined cushion</strong> 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.</p>
</blockquote>

<p>文档似乎没有准确说明这个缓冲垫是什么。也不知道是怎么计算的。有谁知道系统定义的缓冲垫是什么?</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>我认为是 200m。在 Region Monitoring 文档的底部有一段粗略地解释了如何测试:</p>
<blockquote>
<p>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.</p>
<p>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. <strong>However, for testing purposes, you can assume that the minimum distance is approximately 200 meters.</strong></p>
</blockquote></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 什么是 CoreLocation 的区域监控系统定义的缓冲垫?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/21297021/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/21297021/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 什么是 CoreLocation 的区域监控系统定义的缓冲垫?