ios – CLLocationManager的startMonitoringSignificantLocationChanges()和startUpdatingLocation()方法有什么区别?

ios – CLLocationManager的startMonitoringSignificantLocationChanges()和startUpdatingLocation()方法有什么区别?,第1张

概述我正在使用CLLocationManager类.我想定期获取位置更新.我在didUpdateLocations方法中找到了两种获取位置的方法,即startUpdatingLocation()和startMonitoringSignificantLocationChanges().如果我必须在前台模式中跟踪位置更新,那么我应该使用哪种方法? 2之间最重要的区别是: startMonitoringSi 我正在使用CLLocationManager类.我想定期获取位置更新.我在dIDUpdateLocations方法中找到了两种获取位置的方法,即startUpdatingLocation()和startMonitoringSignificantLocationChanges().如果我必须在前台模式中跟踪位置更新,那么我应该使用哪种方法?解决方法 2之间最重要的区别是:

startMonitoringSignificantLocationChanges: it does not rely on the value in the distanceFilter property to generate events. The receiver generates update events only when a significant change in the user’s location is detected

startUpdatingLocation : the receiver generates update events primarily when the value in the distanceFilter property is exceeded

因此,如果您想要更高的精度,请选择startUpdatingLocation,代价是更多的电池消耗,但更精确的位置.这实际上取决于你的目标,你应该评估权衡.

总结

以上是内存溢出为你收集整理的ios – CLLocationManager的startMonitoringSignificantLocationChanges()和startUpdatingLocation()方法有什么区别?全部内容,希望文章能够帮你解决ios – CLLocationManager的startMonitoringSignificantLocationChanges()和startUpdatingLocation()方法有什么区别?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/1059289.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-25
下一篇2022-05-25

发表评论

登录后才能评论

评论列表(0条)

    保存