我刚刚将谷歌地图通过pod更新为1.12.2(原为1.11.1),现在我遇到了这个问题:
无法转换类型的值'(GMSReverseGeocodeResponse!,NSError!) - > Void'到预期的参数类型'GMSReverseGeocodeCallback'(又名'(可选,可选) - >()')
下面:
func mapView(mapView: GMSMapView, didTapAtCoordinate coordinate: CLLocationCoordinate2D) {
// var infoWindow = NSBundle.mainBundle().loadNibNamed("CustomInfoWindow", owner: self, options: nil).first! as! CustomInfoWindow
mapView.clear()
aGMSGeocoder.reverseGeocodeCoordinate(CLLocationCoordinate2DMake(coordinate.latitude, coordinate.longitude)) {
(let gmsReverseGeocodeResponse: GMSReverseGeocodeResponse!, let error: NSError!) -> Void in
let gmsAddress: GMSAddress = gmsReverseGeocodeResponse!.firstResult()!
let cllGeoPoint:CLLocation = CLLocation(latitude:coordinate.latitude, longitude: coordinate.longitude )
self.geoPoint = cllGeoPoint
}
请帮忙吗?
答案 0 :(得分:1)
我不同意丹尼尔的解决方案。
使用v1.12.2版本中的注释更新了ObjC界面,以更准确地反映Swift代码应如何与Google Maps SDK for iOS互操作。请参阅1.12.2 release notes的第三点。
此处的修复是更新您的代码以处理可选值。
答案 1 :(得分:0)
将此添加到pod的pod文件中,或者标题为什么。 Pod' googleMap','〜> 1.11.1'