BB
Size: a a a
S
А
С
t
startLocmanager(){
locationManager.requestWhenInUseAuthorization()
if CLLocationManager.locationServicesEnabled() {
locationManager.requestWhenInUseAuthorization()
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyKilometer
locationManager.pausesLocationUpdatesAutomatically = false
locationManager.requestLocation()
}
} ViewController: CLLocationManagerDelegate {
func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
print(error)
}
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
if let lastlocation = locations.last {
let coordinate = lastlocation.coordinate
print(coordinate.latitude , coordinate.longitude)
}
}
}РГ
А
startLocmanager(){
locationManager.requestWhenInUseAuthorization()
if CLLocationManager.locationServicesEnabled() {
locationManager.requestWhenInUseAuthorization()
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyKilometer
locationManager.pausesLocationUpdatesAutomatically = false
locationManager.requestLocation()
}
} ViewController: CLLocationManagerDelegate {
func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
print(error)
}
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
if let lastlocation = locations.last {
let coordinate = lastlocation.coordinate
print(coordinate.latitude , coordinate.longitude)
}
}
}А
С
FN