엑스 코드는 "CLLocation는" '고도'에는 회원이 없습니다 "하지만"[CLLocation]
locations
이의 배열입니다 일원으로 '고도' ".이없는 말을하지 않습니다
CLLocation
객체와 (이 배열을 그대로) altitude
라는 속성이 없습니다.
무엇을 당신이해야 할 것은 배열에서 하나 개의 값을 추출하고 고도에 액세스하는 것을 사용한다.
을 당신은 아마 원하는 나 한테해라. 이케이이 이후
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
guard let altitude = locations.last?.altitude else { return }
self.Altitude.text = String(altitude)
}
은 당신이 제대로 LengthFormatter
을 사용하여 포맷해야 사용자에 직면 문자열입니다.
작은 스타일 메모 : 변수 이름 (예 : self.Altitude
은 소문자이어야하며 유형 만 PascalCase 임).
출처
2017-02-01 18:49:44
HAS
위치는 위치 배열이며 배열은 '고도'속성을 갖지 않습니다. 먼저 'location [0] .altitude'와 같은 위치 요소 중 하나를 배열 밖으로 가져와야합니다. – HAS