反向地理编码是否需要蜂窝/wifi?我正在使用以下代码查找城市名称和邮政编码。此代码是否可以在具有 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.")
}
})