反向地理編碼是否需要蜂窩/無線?我正在使用以下代碼來查找城市名稱和郵政編碼。此代碼是否可以在具有GPS連接但沒有蜂窩連接的環境中工作?反向地理編碼是否需要蜂窩/無線?
geoCoder.reverseGeocodeLocation(location, completionHandler: { (placemarks, error) -> Void in
print("REVERSE COMPLETED")
// Place details
var placeMark: CLPlacemark!
placeMark = placemarks?[0]
// Address dictionary
print(placeMark.addressDictionary)
// City
if let city = placeMark.addressDictionary!["City"] as? NSString {
print("You are in \(city)")
} else {
print("An error occured while fetching the CITY.")
}
// Zip code
if let zip = placeMark.addressDictionary!["ZIP"] as? NSString {
print("The zip code is \(zip)")
} else {
print("An error occured while fetching the ZIP code.")
}
})
GPS給你經緯度等,它不給你政治界限。 –
這不是「快速反向地理編碼」。地理編碼和反向地理編碼與Swift無關。 – nhgrif
@nhgrif,請不要編輯我的答案,爲風格的東西。您將有關該問題的評論移除爲與swift相關,然後添加與評論幾乎完全相同的內容。 –