How to get current state (USA) from iPhone Core location?

I want my iOS application to display information related to the current state of the user (e.g. California, Oregon, etc.). How is this done using the primary location? The CLLocation class has coordinates - how do I turn this into a state? (FYI I no longer need details such as a city or street)

+4
source share
2 answers
+4
source

As Brad mentioned, you can use Google (or Mapquest et al.) To get reverse geocode information. Google offers data in XML, JSON or CSV format. This way you can use a url like this:

http://maps.google.com/maps/geo?q=LATITUDE,LONGITUDE&output=csv&sensor=true 

So, http://maps.google.com/maps/geo?q=37.032978,-95.620834&output=csv&sensor=true puts you in Coffeyville, KS, and you can get information from there.

FWIW, if you use MapKit, you can also use MKReverseGeocoder to get MKPlacemark.

+3
source

All Articles