Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.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 didTapInfoWindowOfMarker未执行_Ios_Swift_Google Maps Sdk Ios - Fatal编程技术网

Ios didTapInfoWindowOfMarker未执行

Ios didTapInfoWindowOfMarker未执行,ios,swift,google-maps-sdk-ios,Ios,Swift,Google Maps Sdk Ios,我试图简单地获得一个标记的坐标,该标记已被用户选择,然后在谷歌地图中使用。但是,当用户点击标记器的信息窗口时,我无法调用didTapInfoWindowOfMarker函数(“调用的didTap”从未打印到控制台),因此无法获取点击标记器的坐标 这是我的密码: extension MapViewController: GMSMapViewDelegate { func mapView(mapView: GMSMapView!, didTapInfoWindowOfMarker mark

我试图简单地获得一个标记的坐标,该标记已被用户选择,然后在谷歌地图中使用。但是,当用户点击标记器的信息窗口时,我无法调用didTapInfoWindowOfMarker函数(“调用的didTap”从未打印到控制台),因此无法获取点击标记器的坐标

这是我的密码:

extension MapViewController: GMSMapViewDelegate {

    func mapView(mapView: GMSMapView!, didTapInfoWindowOfMarker marker: GMSMarker!) {
       print("Called didTap")
       let googleMarker = mapView.selectedMarker
       let markerValue: CLLocationCoordinate2D = googleMarker.position
       let markerLat = markerValue.latitude
       let markerLong = markerValue.longitude
       print("markerLat: \(markerLat)")
       print("markerLong: \(markerLong)")
       mapView.selectedMarker = nil
       mapView.delegate = self
    }
 }

您必须设置委托。将哪个委托设置为什么@NHGRIFT映射视图的委托给self。我已经在viewDidLoad()中完成了此操作@我把它弄坏了。必须将mapView.delegate=self更改为self.mapView.delegate=self。感谢您回复@nhgrif!您必须设置委托。将哪个委托设置为什么@NHGRIFT映射视图的委托给self。我已经在viewDidLoad()中完成了此操作@我把它弄坏了。必须将mapView.delegate=self更改为self.mapView.delegate=self。感谢您回复@nhgrif!