프로그램에서 사용자 위치를지도에 표시하려고합니다. 처음에는 무작위로 멈추었으므로 아래 코드를 수정하여 문제를 해결했지만 문제가 있습니다. 미리 감사드립니다!위치 권한 확인 및 권한 부여
당신은 호출 할 필요override func viewDidLoad()
{
super.viewDidLoad()
self.locationManager.delegate = self
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest
if CLLocationManager.locationServicesEnabled()
{
let status: CLAuthorizationStatus = CLLocationManager.authorizationStatus()
if status == CLAuthorizationStatus.NotDetermined
{
locationManager.requestAlwaysAuthorization()
}
} else {
print("locationServices disenabled")
}
locationManager.startUpdatingLocation()
self.locationManager.startUpdatingLocation()
self.mapView.showsUserLocation = true
mapView.delegate = self
centerMapOnLocation(initialLocation)
addBoundry()
}
어떤 문제가 있습니까? – eMKa
직면 한 문제에 대한 추가 정보가 필요합니다. 또한 'locationManager'의 'startUpdatingLocation'메소드에 대한 호출이 2 건 있음을 알았습니다. – tek3
info.plist에 필수 입력란을 설정 했습니까? – Rikh