我有一个可用于驾驶,滑雪,步行,火车等的应用程序。应该使用哪个activityType
? CLActivityTypeAutomotiveNavigation
会涵盖所有用例吗?
代码是为了迎合iOS 8和9 - (对于应该删除respondsToSelector
有疑问):
if ([locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)])
{
[locationManager requestWhenInUseAuthorization];
locationManager.activityType = CLActivityTypeAutomotiveNavigation;
}
if ([locationManager respondsToSelector:@selector(pausesLocationUpdatesAutomatically)])
{
locationManager.pausesLocationUpdatesAutomatically = YES;
}