I am trying to get the address for a venue/business name. With the venue name I have the city and state as well, but it is successful less than 10% of the time. The problem seems to be with finding the location and not deciphering the address.
Example Input: "Jazz Kitchen Indianapolis,Indiana"
Typical Output: "No location found"
Thanks!
geocoder.geocodeAddressString(newSearch) { (placemarks, error) in
if let error = error {
print("Geocoding error: \(error.localizedDescription)")
geoError = true
}
if let placemark = placemarks?.first {
if let address = placemark.location?.coordinate {
print("Address: \(address)")
let webLoc = CLLocation(latitude: address.latitude, longitude: address.longitude)
uploadLoc(geoLoc: webLoc)
} else {
print("No address found")
geoError = true
}
} else {
print("No location found")
geoError = true
}
}
For the example request in your question, using
MKLocalSearchworks better thanCLGeocoder.The following code:
gives the following result: