Ich erstelle eine Karte mit swift. Wie kann ich den Namen meines aktuellen Standortes finden, wie er auf Apple-Karten gespeichert ist, wie sagen wir, ich bin bei Walmart, wie bekomme ich es, den Namen des Ortes auszudrucken, und wenn der Ort nur eine Adresse ausdruckt.Ort suchen Name swift maps
Mein aktueller Code ist
class MapVC: UIViewController, CLLocationManagerDelegate {
@IBOutlet weak var map: MKMapView!
let manager = CLLocationManager()
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let location = locations[0]
let span:MKCoordinateSpan = MKCoordinateSpanMake(0.01, 0.01)
let mylocation:CLLocationCoordinate2D = CLLocationCoordinate2DMake(location.coordinate.latitude, location.coordinate.longitude)
let region:MKCoordinateRegion = MKCoordinateRegionMake(mylocation, span)
map.setRegion(region, animated: true)
print(location.coordinate)
print(location.coordinate.latitude)
print(location.speed)
self.map.showsUserLocation = true
self.map.showsPointsOfInterest = true
}
override func viewDidLoad() {
super.viewDidLoad()
manager.delegate = self
manager.desiredAccuracy = kCLLocationAccuracyBest
manager.requestAlwaysAuthorization()
manager.startUpdatingLocation()
}
Mögliches Duplikat von [Koordinaten in Stadtname umwandeln?] (Https://stackoverflow.com/questions/27735835/convert-coordinates-to-city-name) – Emm