3

如何根据正确书写的国家名称提取CLRegion或或纬度/经度点?CLLocationCoordinate2DCLGeocoder这样工作:

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

}


   }];

什么变量CLPlacemark告诉地址?

4

1 回答 1

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

    }


}];  
于 2012-04-13T06:46:34.223 回答