geocodeAddressString not working for swift

Viewed 4827

Hi I am trying to use geocodeAddressString to convert the address to a placemark on the map, but whatever address I passed to this method, the below block will never be executed, could anyone give me some light? Thanks a lot By the way, I can see "before" and "after" on the concole, but without "hello"

  let geo = CLGeocoder()
    print("before")
    geo.geocodeAddressString(("4 Bradford St, Perth WA 6050"), completionHandler: {
        (placemarks, error) -> Void in

        print ("hello")
        if let placemark = placemarks?[0]
       {
          self.mapView.addAnnotation(MKPlacemark(placemark: placemark))
        }
    })

  print ("after")
2 Answers
Related