CLActivityType值之间的差异 – iOS SDK

这些值之间有什么区别:
CLActivityTypeAutomotiveNavigation,CLActivityTypefitness,CLActivityTypeOtherNavigation,

当分配给CLLocationManager的activityType属性时?

文档建议我应该根据我使用CLLocationManager的目的使用它们,但是我没有提供关于确定暂停位置更新的算法差异的提示.

从文档引用:

CLActivityTypeAutomotiveNavigation

[…]
This activity might cause location updates to be
paused only when the vehicle does not move for an extended period of time.

CLActivityTypefitness

[…]This activity might cause location updates to be
paused only when the user does not move a significant distance over a
period of time.

CLActivityTypeOtherNavigation

This activity might cause location updates to be paused only when the vehicle does not move a significant distance over a period of time.

我真的看不出这些描述之间的区别.

文档来源:

https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/#//apple_ref/c/econst/CLActivityTypeOther

解决方法

似乎activityType仅在监控位置时影响电池性能.特别是当它暂停投票地点时.

将暂停轮询时

AutomotiveNavigation – 长时间不动.

其他导航(例如船/火车) – 长时间内移动不多.

健身 – 在较短的时间内移动不多.

其他 – 据推测不会停止投票.

理由是

>对于船只或火车,他们可能已停止,但您仍然可以在他们内部走动,所以您并不真正关心这些小更新.
>对于健身,你可能已经停止了跑步,但你仍然在你家里四处走动…你真的不想让你的电池耗尽.

其他说明

pausesLocationUpdatesAutomatically的文档进一步表明activityType仅确定是否应自动暂停位置更新.

You can help the determination of when to pause location updates by assigning a value to the activityType property.

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...