"표현의 유형이 더 컨텍스트없이 모호"우리가 말하는 아빠 : 섹션에서
func getCurrentLocation() {
// Init LocationManager
locationManager = CLLocationManager()
locationManager.delegate = self
locationManager.desiredAccuracy =
kCLLocationAccuracyThreeKilometers;
let alert = UIAlertController(title: "Allow Loction Services?",
message: "This allows the app to your loction",
preferredStyle: .alert)
let ok = UIAlertAction(title: "Allow", style: .default, handler: {
(action) -> Void in
self.showHUD("loading...")
if locationManager.responds(to:
#selector(CLLocationManager.requestWhenInUseAuthorization)) {
locationManager.requestAlwaysAuthorization()
}}
self.hideHUD()
)
}
let cancel = UIAlertAction(title: "Not Now", style: .destructive,
handler: { (action) -> Void in })
alert.addAction(ok); alert.addAction(cancel)
present(alert, animated: true, completion: nil)
locationManager.startUpdatingLocation()
}
self.hideHUD()
은 완료 핸들러 블록을 표시하는 중} 호 외부에 있습니다.
난 당신이 HUD 숨길 또 다른 후 을 오는 대신에 위의 라인에 두 중괄호, 단일 중괄호를 원하는 것으로 의심 :
.......
locationManager.requestAlwaysAuthorization()
}
self.hideHUD()
}
........