解决方法
你想看看
func locationManager(manager: CLLocationManager,didChangeAuthorizationStatus status: CLAuthorizationStatus)
和
CLLocationManager.authorizationStatus()
第一个是在用户更改授权状态时调用的,第二个是允许您随时确定当前状态.
然后,显示消息,例如:
let alert = UIAlertController(title: "Your title",message: "GPS access is restricted. In order to use tracking,please enable GPS in the Settigs app under Privacy,Location Services.",preferredStyle: UIAlertControllerStyle.Alert) alert.addAction(UIAlertAction(title: "Go to Settings Now",style: UIAlertActionStyle.Default,handler: { (alert: UIAlertAction!) in print("") UIApplication.sharedApplication().openURL(NSURL(string:UIApplicationopenSettingsURLString)!) }))