【发布时间】:2016-10-10 11:05:02
【问题描述】:
这是我的代码
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)
}
}
在我的应用程序中执行此代码 sn-p 正常,没有发生运行时错误。
但是,被调用的最后一行是
geoCoder.reverseGeocodeLocation(loca){(placemarks, error)
我还仔细检查了loca 不为零。
为什么没有调用完成处理程序?
【问题讨论】:
-
geoCoder 是在哪里定义的?它是您的视图控制器的成员吗?
标签: ios swift swift3 cllocation reverse-geocoding