soysauce44
soysauce44

Reputation: 41

Get business name from CLPlacemark

I'm trying to get the business name from a CLLocation. I am able to get the exact street address by reverse geocoding the CLLocation, but am unable to get the name of the business, as the name property on CLPlacemark is just the address.

I have tried:

What's strange is that the Apple Maps app allows you to search for the street address and the business name will come up for most locations (and use the address as a fallback, as seen here), but I cannot replicate this feature with the exposed API's. Is what I'm wanting simply not possible with MapKit?

CLGeocoder().reverseGeocodeLocation(location, completionHandler: { (placemarks, error ) in
            guard let placemarks = placemarks else {
                fatalError("Error: failed to reverse geocode location. \(error?.localizedDescription ?? "")")
            }


            for placemark in placemarks {
                print(placemark.name)
            }

            // Do something to get the *true* placemark name.
        })

Upvotes: 2

Views: 416

Answers (0)

Related Questions