Asinox
Asinox

Reputation: 6865

GMSReverseGeocodeCallback after updated google map via pod

I just updated the google map via pod to 1.12.2 (was 1.11.1), and now im having this issue:

Cannot convert value of type '(GMSReverseGeocodeResponse!, NSError!) -> Void' to expected argument type 'GMSReverseGeocodeCallback' (aka '(Optional, Optional) -> ()')

Here:

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

    }

Any help please?

Upvotes: 0

Views: 465

Answers (2)

Brett
Brett

Reputation: 2399

I disagree with Daniel's fix.

The ObjC interface was updated with annotations in the v1.12.2 release to more correctly reflect how Swift code should interoperate with Google Maps SDK for iOS. See the third point of the 1.12.2 release notes.

The fix here is to up date your code to deal with the optional values.

Upvotes: 1

Dan Leonard
Dan Leonard

Reputation: 3405

Add this to your pod file for the pod or what ever it is titled. Pod 'googleMap', '~>1.11.1'

Upvotes: 0

Related Questions