iOS 对话框提示出现后半秒钟就会消失:
let locationManager = CLLocationManager()
switch CLLocationManager.authorizationStatus() {
case .authorizedWhenInUse:
print("In Use \(locationManager.location?.description)")
case .denied, .restricted:
print("denied")
case .notDetermined:
locationManager.requestWhenInUseAuthorization()
case .authorizedAlways:
print("always \(locationManager.location)")
}
我不知道这是否相关,但我正在使用SWReavealViewController。 Xcode9编译,适用于iOS 8.0,模拟器和真实设备均可。