これは私のコードで私のアプリでは、このコードスニペットのスウィフト3:reverseGeocodeLocationは、その完了ハンドラない
if loc.latitude != 0.0 && loc.longitude != 0.0 {
let loca = CLLocation(latitude: loc.latitude, longitude: loc.longitude)
geoCoder.reverseGeocodeLocation(loca) { (placemarks, error) in // this is the last line that is being called
var placemark : CLPlacemark!
placemark = placemarks?[0]
city = (placemark.addressDictionary?["City"] as! String)
}
}
実行は右になり、何も実行時エラーが発生していません。
しかし、呼び出されている最後の行は、私はまた、二重loca
がnilでないことを確認
geoCoder.reverseGeocodeLocation(loca){(placemarks, error)
です。
なぜ完了ハンドラが呼び出されていないのですか?
geoCoderはどこで定義されていますか?あなたのView Controllerのメンバーですか? – xpereta