我有一個經度/緯度位置,我想將其轉換爲Swift中的位置名稱String。做這個的最好方式是什麼?我相信最好使用reverseGeocodeLocation函數,但不完全確定如何。這是我到目前爲止有:將GPS座標轉換爲Swift中的城市名稱/地址
func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!) {
if (locationFixAchieved == false) {
locationFixAchieved = true
var locationArray = locations as NSArray
var locationObj = locationArray.lastObject as CLLocation
var coord = locationObj.coordinate
var latitude = coord.latitude
var longitude = coord.longitude
getCurrentWeatherData("\(longitude)", latitude: "\(latitude)")
reverseGeocodeLocation(location:coord, completionHandler: { (<#[AnyObject]!#>, <#NSError!#>) -> Void in
<#code#>
})
}
}
func reverseGeocodeLocation(location: CLLocation!, completionHandler: CLGeocodeCompletionHandler!){
}
附我所嘗試。我想我必須使用reverseGeocodeLocation函數,但不知道如何 – 2014-10-07 00:21:21