iOS使用系统自带的mapView定位大头针偏差很大,请问如何解决?
iOS使用系统自带的mapView定位大头针偏差很大,经过查找发现是因为坐标系的问题,请问谁又可以解决的方案呢?谢谢!
魔性触手姬
9 years, 5 months ago
Answers
Hello,
如果你在用苹果自带的地图的话,可以在CLLocationManger的实施set最准确的位置: self.locationManager.desiredAccuracy = kCLLocationAccuracyBest
比如:
let locationManager = CLLocationManager()
override func viewDidLoad() {
super.viewDidLoad()
self.locationManager.delegate = self
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest // 最准的位置信息
self.locationManager.requestWhenInUseAuthorization()
self.locationManager.startUpdatingLocation()
self.mapView.showsUserLocation = true // 显示用户的位置
}
你快间子间
answered 9 years, 5 months ago