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!
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
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.