CLPlacemark - State Abbreviations?

后端 未结 7 1466
隐瞒了意图╮
隐瞒了意图╮ 2021-02-19 00:24

I was wondering if it was possible to get the state abbreviations from CLPlacemark?

In the CLPlacemark Reference from Apple it states:

administrativeArea The sta

7条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-19 00:46

    For people who need the state list with objects and keys swapped (e.g. on iOS 7 I get "CA" from placemark.administrativeArea):

    NSDictionary *nameAbbreviations = [NSDictionary dictionaryWithObjectsAndKeys:
        @"alabama",@"AL",
        @"alaska",@"AK",
        @"arizona",@"AZ",
        @"arkansas",@"AR",
        @"california",@"CA",
        @"colorado",@"CO",
        @"connecticut",@"CT",
        @"delaware",@"DE",
        @"district of columbia",@"DC",
        @"florida",@"FL",
        @"georgia",@"GA",
        @"hawaii",@"HI",
        @"idaho",@"ID",
        @"illinois",@"IL",
        @"indiana",@"IN",
        @"iowa",@"IA",
        @"kansas",@"KS",
        @"kentucky",@"KY",
        @"louisiana",@"LA",
        @"maine",@"ME",
        @"maryland",@"MD",
        @"massachusetts",@"MA",
        @"michigan",@"MI",
        @"minnesota",@"MN",
        @"mississippi",@"MS",
        @"missouri",@"MO",
        @"montana",@"MT",
        @"nebraska",@"NE",
        @"nevada",@"NV",
        @"new hampshire",@"NH",
        @"new jersey",@"NJ",
        @"new mexico",@"NM",
        @"new york",@"NY",
        @"north carolina",@"NC",
        @"north dakota",@"ND",
        @"ohio",@"OH",
        @"oklahoma",@"OK",
        @"oregon",@"OR",
        @"pennsylvania",@"PA",
        @"rhode island",@"RI",
        @"south carolina",@"SC",
        @"south dakota",@"SD",
        @"tennessee",@"TN",
        @"texas",@"TX",
        @"utah",@"UT",
        @"vermont",@"VT",
        @"virginia",@"VA",
        @"washington",@"WA",
        @"west virginia",@"WV",
        @"wisconsin",@"WI",
        @"wyoming",@"WY",
        nil];
    

提交回复
热议问题