【问题标题】:Which gives a more accurate location?哪个给出更准确的位置?
【发布时间】:2011-04-12 03:50:24
【问题描述】:

这两种方法中哪一种在确定用户位置时更准确?

// First
[locationManager startUpdatingLocation]

// Second
[locationManager startMonitoringSignificantLocationChanges]

【问题讨论】:

    标签: objective-c ios4 core-location


    【解决方案1】:

    根据Apple CoreLocation documentationstartUpdatingLocation更准确。来自文档:

    您可以通过调用 startUpdatingLocation 方法来启动标准位置服务。此服务最适合需要对位置事件的传递进行更细粒度控制的应用程序。具体来说,它会考虑 desiredAccuracy 和 distanceFilter 属性中的值来确定何时传递新事件。这最适合导航应用程序或任何需要高精度位置数据或定期更新流的应用程序。

    将此与startMonitoringSignificantLocationChanges 进行对比,根据文档,后者更粗略且不太准确:

    对于不需要常规位置事件流的应用程序,您应该考虑使用 startMonitoringSignificantLocationChanges 方法来开始传递事件。这种方法更适合大多数只需要初始用户位置修复并且仅在用户移动很长距离时才需要更新的应用程序。此界面仅在检测到设备关联的信号塔发生变化时才会提供新事件,从而降低更新频率并显着提高电源使用率。

    您可以使用CLLocationManager 类的desiredAccuracy 属性控制位置更新的准确性。

    【讨论】:

      【解决方案2】:

      第一个会在CLLocationManager 类的desiredAccuracy 集合中为您提供更新。另请注意,distanceFilter 也很重要。

      仅当您移动“显着”距离时才会触发显着的位置更改,这意味着更新很少。

      在此处查找文档:http://developer.apple.com/library/ios/#documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html

      【讨论】:

        猜你喜欢
        • 2019-09-28
        • 1970-01-01
        • 2016-04-10
        • 1970-01-01
        • 1970-01-01
        • 2016-06-26
        • 2016-12-09
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多