안녕하세요, 지오 코드를 뒤집어 쓰려고하는 [ "37.7", "-122.4"] 좌표가 있습니다. 그래서 나는 도시와 국가에 간단한 UI 레이블을달라고 할 수 있습니다. 그러나 CALLocation을 사용하여 placeAck에 표준으로 제공되는 administrativeArea var/메소드를 통해 상태를 가져올 때 nil을 반환합니다.ClLocation Placemark가 administrativeArea를 반환하지 않습니다.
▿ 몇 가지 : 1 개 요소 - 0 : 샌프란시스코 베이, 샌프란시스코 베이, 샌프란시스코, 미국 @ + 37.80000000 <, -122.50000000> +/- 100.00m, 지역 CLCircularRegion (식별자 : '< + 37.79999999, -122.50000000> 반경 141.72 '센터 : < + 37.79999999, -122.50000000>, 반경 : 141.72m)는
이것은 내가 다시 완료 핸들러에서 무엇을 얻을 수 있습니다. 어떤 국가가 돌아 오지 않는지 분명히합니다. 왜 그렇게 될 것이며 어떻게 아직도 국가를 얻을 수 있을까요?
이 액톤을 제어하는 코드 블록은 모든 도움을받을 수 있습니다.
CLGeocoder().reverseGeocodeLocation(location, completionHandler: { (placeMark, error) in
if error != nil{
print("There was an error")
}else{
if let place = placeMark?[0]{
print(place)
print(place.locality ?? "")
print(place.subAdministrativeArea ?? "")
let myAttribute = [NSAttributedStringKey.font:UIFont(name: "Times New Roman", size: 15.3)!]
let myAttrString = NSAttributedString(string: place.locality ?? "", attributes: myAttribute)
locLabel.attributedText = myAttrString
}
}
})
여기에 데이터베이스에 오류가 있다고 생각되면 Apple에 버그를 신고 할 수 있습니다. – matt
그래, 나는 단지 내가 물 한 몸에 있다는 것을 깨달았다. –