gpt4 book ai didi

iphone - iOS5 区域监测精度

转载 作者:可可西里 更新时间:2023-11-01 05:57:41 30 4
gpt4 key购买 nike

我正在尝试使用 iOS5/iPhone 4G 进行精确的区域监控,但我的运气似乎不太好。需要明确的是,我能够获得区域进入事件;只是我过早地得到了它们。让我解释。这是我设置区域的代码:

#define GEO_FENCING_RADIUS 10  // in meters

CLLocationDistance radius = GEO_FENCING_RADIUS;

// Create the region and start monitoring it.
CLRegion* region = [[CLRegion alloc] initCircularRegionWithCenter:coordinate
radius:radius
identifier:identifier];
[self.locationManager startMonitoringForRegion:region
desiredAccuracy:kCLLocationAccuracyBest];

在此代码中,半径设置为 10 米。那么,我的假设是,如果我在该位置的 10 米范围内,我只会收到区域通知。相反,我可以在更高的距离值处收到通知(我已经看到 2 英里的接近度触发了该区域)。什么会导致这个?此外,我使用 significantLocationChangeMonitoringAvailable 和为 CLLocationManager 设置的默认值。也许使用 significantLocationChangeMonitoringAvailable 会以某种方式排除更准确的触发事件?

知道这里发生了什么吗?

最佳答案

重大地点变更服务仅适用于重大地点变更。来自docs :

This method indicates whether the device is able to report updates based on significant location changes only. (Significant location change monitoring primarily involves detecting changes in the cell tower currently associated with the device.) This capability provides tremendous power savings for applications that want to track a user’s approximate location and do not need highly accurate position information.

区域监控的工作方式相同,因此它只能在您距离某个兴趣点大约 1 公里以内时告诉您。 (请注意,由于这是基于手机信号塔的定位,您将获得或多或少的准确性,具体取决于该地区手机信号塔的密度,并且只能在具有蜂窝连接的设备上使用这种方法——没有 iPod touch 或WiFi iPad。)

如果您既想要区域监控/显着变化监控的强大优势,又想要在感兴趣区域内精确跟踪位置的能力,那么您首先只需要为前者进行设置……然后,一旦您位于/靠近感兴趣的区域,请切换到更高精度的监控。 (最好使用 CLLocationManager 的单独实例来完成此操作。)

关于iphone - iOS5 区域监测精度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9692840/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com