Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/100.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 如何使用nil响应从GMSGeocoder REVERSEGOCODECOLDORM获取最近的人类可读地址_Ios_Swift_Google Maps_Google Maps Sdk Ios_Reverse Geocoding - Fatal编程技术网

Ios 如何使用nil响应从GMSGeocoder REVERSEGOCODECOLDORM获取最近的人类可读地址

Ios 如何使用nil响应从GMSGeocoder REVERSEGOCODECOLDORM获取最近的人类可读地址,ios,swift,google-maps,google-maps-sdk-ios,reverse-geocoding,Ios,Swift,Google Maps,Google Maps Sdk Ios,Reverse Geocoding,在我的iOS应用程序中,我想让用户在GMSMapView上用长按手势选择地址。因此,我实现了mapView:uLongPressatCoordinate:方法来获取他选择的坐标,并进行反向编码并获取地址: let geocoder = GMSGeocoder() geocoder.reverseGeocodeCoordinate(coordinate) { response, error in if let address = response?.firstRe

在我的iOS应用程序中,我想让用户在
GMSMapView
上用长按手势选择地址。因此,我实现了
mapView:uLongPressatCoordinate:
方法来获取他选择的坐标,并进行反向编码并获取地址:

    let geocoder = GMSGeocoder()

    geocoder.reverseGeocodeCoordinate(coordinate) { response, error in
        if let address = response?.firstResult() {
            // Everything ok
        } else {
            // Here the response is 'nil'
        }
    }

当响应为
nil
时,我可以在这里做些什么,以获得具有人类可读地址的最近位置坐标?

请提供错误日志。没有错误<代码>错误var为零。简单地说,
response
也为零。如果在执行
mapView:uLongPressatCoordinate:
时获取坐标,您是否检查了日志?如果没有,我在这里发现了一个关于[如何获取地图上的触摸位置]()的现有SO问题。我希望这对你有帮助。位置坐标有效。例如,问题是当用户在海上长时间敲击时。那里没有有效地址,我想找到最近的地址。