How can I get city name and country name from timezone? For example, I can see all knownTimeZoneNames array, and I want to show in labels "Europe/Moscow" as "Moscow, Russia" in few languages. How can I get this strings? Actually I need localized list, as in Clock.app in iPhone.
Asked
Active
Viewed 1,910 times
1 Answers
0
You can get country name from city name like this:
first import the Core Location framework
CLGeocoder *gc = [[CLGeocoder alloc] init];
[gc geocodeAddressString:@"Moscow"
completionHandler:^(NSArray *placemarks, NSError *error)
{ CLPlacemark *placeMark = [[CLPlacemark alloc] initWithPlacemark:(CLPlacemark *)[placemarks objectAtIndex:0]]; NSLog(@"placeMark.country: %@", placeMark.country);
}
];

Alex Shesterov
- 26,085
- 12
- 82
- 103

Miguel Ehrstrand
- 71
- 1
- 5
-
1can i got list of the city from the country name in ios? – Jignesh B Jun 02 '15 at 09:51
-
can anyone help translating this to swift? – grep Sep 28 '22 at 19:55