question
when CLLocationManager positioning is used in
iOS, the first location will be located (0d0), and the second time will be normal
.platform
Xcode10
related codes
func mapViewDidStopLocatingUser (_ mapView: MKMapView)
{
let userCoordinate = mapView.userLocation.coordinate
if userCoordinate.latitude != 0 || userCoordinate.longitude != 0
{
mapView.setRegion(MKCoordinateRegion(center: userCoordinate, span: MKCoordinateSpan(latitudeDelta: 0.5, longitudeDelta: 0.5)), animated: true)
}
}
console output:
first location
It is requestAlwaysAuthorization in service.
Locating you = CLLocationCoordinate2D (latitude: 0.0, longitude: 0.0)
second location:
It is requestAlwaysAuthorization in service.
Locating you = CLLocationCoordinate2D (latitude: 40.323220237616745, longitude: 120.351864600588)
third location:
It is requestAlwaysAuthorization in service.
Locating you = CLLocationCoordinate2D (latitude: 40.32324630077117, longitude: 120.35181804451575)
what result do you expect? What is the error message actually seen?
want to know what causes this bug?