Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios objective-c谷歌地图委托方法反向协调方法_Ios_Objective C_Google Maps_Geocoding_Reverse Geocoding - Fatal编程技术网

Ios objective-c谷歌地图委托方法反向协调方法

Ios objective-c谷歌地图委托方法反向协调方法,ios,objective-c,google-maps,geocoding,reverse-geocoding,Ios,Objective C,Google Maps,Geocoding,Reverse Geocoding,我不确定这是否是谷歌地图的新功能,但我认为这一版本的谷歌地图iOS版已经有了一种反向地理编码方法……我真的不知道如何使用它,在“摄像头位置”部分下,它们有一个功能,但它看起来不像SDK附带的功能……或者这里有一些我不明白的地方。有人能帮忙吗?下面是XCode中出现的函数: - (void)reverseGeocodeCoordinate:(CLLocationCoordinate2D)coordinate completionHandler:(GMSReverseGeocodeCall

我不确定这是否是谷歌地图的新功能,但我认为这一版本的谷歌地图iOS版已经有了一种反向地理编码方法……我真的不知道如何使用它,在“摄像头位置”部分下,它们有一个功能,但它看起来不像SDK附带的功能……或者这里有一些我不明白的地方。有人能帮忙吗?下面是XCode中出现的函数:

- (void)reverseGeocodeCoordinate:(CLLocationCoordinate2D)coordinate 
    completionHandler:(GMSReverseGeocodeCallback)handler{}
如果我的坐标在一个数组中,我如何使用它?如何获得地址、国家和所有可能的结果

顺便说一句,这就是他们所拥有的……如何比较:

- (void)mapView:(GMSMapView *)mapView
idleAtCameraPosition:(GMSCameraPosition *)cameraPosition {
id handler = ^(GMSReverseGeocodeResponse *response, NSError *error) {
if (error == nil) {
  GMSReverseGeocodeResult *result = response.firstResult;
  GMSMarker *marker = [GMSMarker markerWithPosition:cameraPosition.target];
  marker.title = result.addressLine1;
  marker.snippet = result.addressLine2;
  marker.map = mapView;
}
};
[geocoder_ reverseGeocodeCoordinate:cameraPosition.target completionHandler:handler];
}
你可以试试这个代码

[[GMSGeocoder geocoder]reverseGeocodeCoordinate:CLLocationCoordinate2DMake(latitude, longitude)
completionHandler:^(GMSReverseGeocodeResponse * response, NSError *error){
    for(GMSReverseGeocodeResult *result in response.results){
        NSLog(@"addressLine1:%@", result.addressLine1);
        NSLog(@"addressLine2:%@", result.addressLine2);
    } 
}];