我想知道是否有办法从MKMapView获得接收位置的准确性。
我本以为下面的代码会起作用,但事实并非如此。我也可以直接登录房产吗?
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation {
if (userLocation.location.horizontalAccuracy == kCLLocationAccuracyBest) {
NSLog(@"Best");
}
if (userLocation.location.horizontalAccuracy == kCLLocationAccuracyBestForNavigation) {
NSLog(@"Best for nav");
}
if (userLocation.location.horizontalAccuracy == kCLLocationAccuracyHundredMeters) {
NSLog(@"100m");
}
if (userLocation.location.horizontalAccuracy == kCLLocationAccuracyKilometer) {
NSLog(@"km");
}
if (userLocation.location.horizontalAccuracy == kCLLocationAccuracyNearestTenMeters) {
NSLog(@"10m");
}
if (userLocation.location.horizontalAccuracy == kCLLocationAccuracyThreeKilometers) {
NSLog(@"3km");
}
}
圆圈通常通过将其包裹在蓝色的小圆上来表示位置的准确性,因此精度显然是在发送的。
谢谢你能提供的任何帮助。
CLLocation
中的horizontalAccuracy
属性指示坐标的当前实例的准确性。
地图视图使用的不是"desiredAccuracy"(可以在CLLocationManager
中设置和读取的属性)。据我所知,MKMapView
中无法访问该设置。
然而,在Breadcrumb示例应用程序的BreadcrumbViewController.m文件中有这样的注释:
// Note: we are using Core Location directly to get the user location updates.
// We could normally use MKMapView's user location update delegation but this does not work in
// the background. Plus we want "kCLLocationAccuracyBestForNavigation" which gives us a better accuracy.
因此,这意味着MKMapView
至少没有使用kCLLocationAccuracyBestForNavigation
。
是否调用了此委托方法?确保已将MKMapView
实例的showsUserLocation
设置为YES