if let appSettings = NSURL(string: UIApplicationOpenSettingsURLString) {
if isLocationServiceOpen() {
let alertCon = UIAlertController
.init(title:
"端末位置坐标没有被允许,引导用户去设置打开坐标", message: nil, preferredStyle:
.alert)
let cancelAction = UIAlertAction
.init(title:
" キヤンセル", style:
.cancel, handler: nil)
let okAction = UIAlertAction
.init(title:
"设定", style:
.default, handler: { (action)
in
UIApplication
.shared.openURL(appSettings as URL)
})
alertCon
.addAction(cancelAction)
alertCon
.addAction(okAction)
self
.present(alertCon, animated: true, completion: nil)
}
}
func isLocationServiceOpen
() -> Bool {
if CLLocationManager.authorizationStatus() == CLAuthorizationStatus.denied {
return true
}
else {
return false
}
}