0

In my application, I m getting City name from current location using MKReverseGeocoder

I also getting Country code but I want is City code too.

For exmaple If I get New York city than i want to get NY. So i can show New York, NY

can any one help please how can i get or any link ?

Thanks in advance!

Nikunj
  • 987
  • 11
  • 25

1 Answers1

1

NY isn't a "city code", it's the abbreviation for the State of New York. A US state is an administrativeArea as far as MKPlacemark/CLPlacemark is concerned. The geocoder only provides one canonical city name -- if you want an abbreviation for it, you'll have to look somewhere else.

Also note that on iOS 5.0 and newer, you should be using CLGeocoder, not the deprecated MKReverseGeocoder.

rickster
  • 124,678
  • 26
  • 272
  • 326
  • okay thanks for reply but i am not clear from above that can i get abbreviation for cityname or not ? – Nikunj Feb 22 '13 at 07:01
  • 1
    Cities have canonical names, but not necessarily canonical abbreviations. Apple's geocoder (and most other geocoders) only provide the former. – rickster Feb 22 '13 at 07:04