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 に答える