Coordinates/Region from Country Name
core-location, ios, mapkit, objective-c, xcode
Solution
Never mind figured it out:
CLGeocoder *geoCode = [[CLGeocoder alloc] init];
[geoCode geocodeAddressString:@"Singapore" completionHandler:^(NSArray *placemarks, NSError *error) {
if (!error) {
CLPlacemark *place = [placemarks objectAtIndex:0];
CLLocation *location = place.location;
CLLocationCoordinate2D coord = location.coordinate;
NSLog(@"%g is latitude and %g is longtitude", coord.latitude, coord.longitude);
}
}];
Problem
How can I extract a `CLRegion` or `CLLocationCoordinate2D` or latitude/longitude points based on a correctly written country name? Would `CLGeocoder` work like this: ``` CLGeocoder *geoCode = [[CLGeocoder alloc] init]; [geoCode geocodeAddressString:@"Singapore" completionHandler:^(NSArray *placemarks, NSError *error) { if (!error) { CLPlacemark *place = [placemarks objectAtIndex:0]; NSLog(@"%i,%i", place.//what would i put here); } }]; ``` What variable does a `CLPlacemark` hold that tells the address?