来自国家/地区名称的坐标/区域

MCK*_*pur 3 xcode objective-c core-location mapkit ios

如何根据正确书写的国家/地区名称提取CLRegionCLLocationCoordinate2D或纬度/经度点?会CLGeocoder像这样工作:

 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);

}


   }];
Run Code Online (Sandbox Code Playgroud)

CLPlacemark告诉地址的变量是什么?

MCK*_*pur 5

没关系想通了:

  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);

    }


}];  
Run Code Online (Sandbox Code Playgroud)