Nikunj
Nikunj

Reputation: 987

Get city code for the city which get from current location eg., New York, NY

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!

Upvotes: 0

Views: 286

Answers (1)

rickster
rickster

Reputation: 126167

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.

Upvotes: 1

Related Questions