tags:

views:

47

answers:

2

I am using the MapKit for the iPhone and have it setup to get the user's location and display it on the view. But I need to know which state they're in so I know what data to load and display to the user. Is there any way to get that sort of info?

A: 

Ok, so it seems the MKReverseGeocoder can do this, but I've yet to determine how, I'll do some digging.

+1  A: 

Have a look at the CurrentAddress code sample:

It makes use of the MKReverseGeocoder class that provides services for converting your map coordinate (specified as a latitude/longitude pair) into information about that coordinate, such as the country, city, or street. A reverse geocoder object is a single-shot object that works with a network-based map service to look up placemark information for its specified coordinate value. To use placemark information is leverages the MKPlacemark class to store this information.

Ben S
Ok, yeah, the MKPlacemark's administrativeArea gives you the state. It says in the documentation that it gives EITHER the abbreviation or the entire name. Now to determine how to get the abbreviation. Thank you!