import CoreLocationclass VIEwController: UIVIEwController,UITextFIEldDelegate,CLLocationManagerDelegate { var locationManager:CLLocationManager = CLLocationManager() overrIDe func vIEwDIDLoad() { super.vIEwDIDLoad() self.locationManager.delegate = self locationManager.desiredAccuracy = kCLLocationAccuracyBest locationManager.requestAlwaysAuthorization() locationManager.startUpdatingLocation() } func locationManager(manager: CLLocationManager,dIDChangeAuthorizationStatus status: CLAuthorizationStatus) { print("dIDChangeAuthorizationStatus") switch status { case .NotDetermined: print(".NotDetermined") break case .Authorized: print(".Authorized") self.locationManager.startUpdatingLocation() break case .DenIEd: print(".DenIEd") break default: print("Unhandled authorization status") break } } func locationManager(manager: CLLocationManager,dIDUpdateLocations locations: [CLLocation]) { let location = locations.last as CLLocation! print("dIDUpdateLocations: \(location.coordinate.latitude),\(location.coordinate.longitude)") }
仅提供输出
dIDChangeAuthorizationStatus.NotDetermined
如果有可能我想在新位置改变时采用长拉特值.
谢谢 !
<key>NSLocationAlwaysUsageDescription</key><string>Your message goes here</string><key>NSLocationWhenInUseUsageDescription</key><string>Your message goes here</string>总结
以上是内存溢出为你收集整理的ios – Swift后台使用Core Location获取位置更新全部内容,希望文章能够帮你解决ios – Swift后台使用Core Location获取位置更新所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)