MKReverseGeocoder not returning SubAdministrativeArea

554 Views Asked by At

I use MKReverseGeocoder in my app to get the state (AdministrativeArea) and county (SubAdministrativeArea) that my user is located in.

I've just noticed that there is no value (null) being returned for SubAdministrativeArea. State is working correctly. This has worked correctly in the past, and I'm not sure exactly when it stopped working. I'm getting the same behavior from the Simulator, 3GS, and WiFi iPad 1. I've also had reports of this from a user who is several hundred miles away (same State, different county).

Has anyone else experienced this? I haven't found any other similar error reports.

2

There are 2 best solutions below

0
On

I have recently played with MKReverseGeocoder and have found it somewhat unreliable. Sometimes, there was no street number returned, and also the SubAdministrativeArea was null in some cases. Also, the Locality (city) value was null in some cases.

Using MKReverseGeocoder makes you dependent on the data source, which might not be what you are expecting. For instance, having played with it in New York, I notice that Queens is sometimes returned in Locality (city), while Brooklyn appears as a SubAdministrativeArea (county).

You could test this behavior easily in different states by setting a MKMapView and try different points, or just get a defined set of coordinates from different states/cities/countries and run them on a test app.

You could also try using the Google Maps Geocoding API directly, as it will return several results instead of one. However, this probably will require more work as you need to do the parsing manually. Here is a sample response.

0
On

I ran into the exact same issue and resorted to using the addressDictionary placemark attribute, e.g.,

[placemark.addressDictionary objectForKey@"City"]

instead of

placemark.subAdministrativeArea