I have been using CLGeocoder’s “geocodePostalAddress” API for many years, and it’s been working just fine. Since yesterday, a lot of users have started complaining that they are getting “no results” for their geocoding requests, and I have also confirmed this case. It seems like the “geocodePostalAddress” returns “No Result” in many cases where it used to work correctly before, even though the “geocodeAddressString” API still works correctly. Has anyone else noticed this problem? Has there been some server change that is causing this?
Here's a unit test I wrote to test this out:
import CoreLocation
final class CJTestCLGeocoderRequests: XCTestCase {
func testGeocoderWithCNPostalAddressBerkeley() async throws {
let geocoder = CLGeocoder()
do {
let postalAddress = CNMutablePostalAddress()
postalAddress.street = "2300 College Ave"
postalAddress.city = "Berkeley"
postalAddress.state = "CA"
postalAddress.postalCode = "94108"
postalAddress.country = "United States"
let placemarks3 = try await geocoder.geocodePostalAddress(postalAddress)
XCTAssertTrue(placemarks3.count > 0, "Geocoder works and gets an placemark")
XCTAssertTrue(placemarks3.first?.postalCode == "94108", "Geocode placemark has right postal code")
} catch {
XCTFail("Geocoder failed: placemarks = \(error).") // get failure here, with error code 8 (
}
do {
let collegeAveString = "2300 College Ave, Berkeley, CA, 94704, United States"
let placemarksString = try await geocoder.geocodeAddressString(collegeAveString)
XCTAssertTrue(placemarksString.count > 0, "Geocoder works and gets an placemark")
XCTAssertTrue(placemarksString.first?.postalCode == "94704", "Geocode placemark has right postal code")
} catch {
XCTFail("Geocoder failed: placemark string = \(error).")
}
}
Would love any help regarding this.