MapView 등록: 스토리보드에서 컨트롤러에 맵뷰를 등록해준다.
extension
: CLLocationManagerDelegate 채택
!
delegate를 채택했으니까..
locationManager.delegate = self
delegate 구현
didUpdateLocations
didFailWithError
locationManagerDidChangeAuthorization
didChangeAuthorization
위치 접근이 성공한 경우: didUpdateLocations
→ getCurrentAddress(location:)을 통해서 현재 위치에 대한 정보를 받고
위치 접근이 실패한 경우: didFailWithError
위치 접근 권한 변경
locationManagerDidChangeAuthorization
didChangeAuthorization
→ checkUsersLocationServicesAuthorization()으로 권한 요청
→ 이제 주황색으로 쓴 함수들을 구현해 주면 된다!
위치 접근에 성공했을 때 위치 정보 얻어오기
: getCurrentAddress(location:)
func getCurrentAddress(location: CLLocaation) {
}
위치 접근 권한 변경이 감지 되었을 때 권한을 요청하기:
: checkUsersLocationServicesAuthorization(authorizatonStatus)
func checkUsersLocationServicesAuthorization(authorizatonStatus) {
//확인해봤는데 안된다고 하면!
checkCurrentLocationAuthorization(authorizationStatus:)
}
checkCurrentLocationAuthorization(authorizationStatus:)