0
彈出詢問位置沒有顯示出來,或者當它顯示出來後,它在幾秒鐘後消失,位置只有在經歷設置和設置允許定位服務時才起作用。我認爲這可能是一個問題,實際彈出窗口。定位不起作用
let locationManager = CLLocationManager()
let authStatus: CLAuthorizationStatus =
CLLocationManager.authorizationStatus()
if authStatus == .notDetermined {
locationManager.requestWhenInUseAuthorization()
}
if authStatus == .denied || authStatus == .restricted {
showLocationServicesDeniedAlert()
return
您需要確保它是從主線程調用的。 – Swinny89