【发布时间】:2015-10-08 03:24:42
【问题描述】:
我正在使用 CLGeocoder reverseGeocodeLocation。我在运行大约 5-10 分钟后崩溃(没有明显的模式)并随机崩溃。这是我的代码:
if CLLocationManager.authorizationStatus() == .AuthorizedWhenInUse {
let currentLatCoord = manager.location?.coordinate.latitude
let currentLongCoord = manager.location?.coordinate.longitude
CLGeocoder().reverseGeocodeLocation(CLLocation(latitude: currentLatCoord!, longitude: currentLongCoord!)) { (placemarks, error) -> Void in
if error != nil {
print(error)
return
}
let placeArray = placemarks as [CLPlacemark]!
var placeMark: CLPlacemark
placeMark = placeArray![0]
self.locationLabel.text = String(placeMark.addressDictionary?["Thoroughfare"]!)
}
}
另外,为了帮助,这里是线条和错误的图片:
【问题讨论】:
标签: ios swift reverse-geocoding