【发布时间】:2017-08-29 06:43:08
【问题描述】:
我有requestAlwaysAuthorization,如果用户不接受requestAlwaysAuthorization,我每次都需要跟踪用户我想退出应用程序吗?
我该怎么做?
我的代码在下面。
import CoreLocation
public var locationManager = CLLocationManager()
override func viewDidLoad() {
super.viewDidLoad()
locationManager.delegate = self
locationManager.requestAlwaysAuthorization()
locationManager.startUpdatingLocation()
}
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let altitudeG = locations.last?.altitude
let longitudeG = locations.last?.coordinate.longitude
let latitudeG = locations.last?.coordinate.latitude
print("\(altitudeG) \(longitudeG) \(latitudeG)")
}
【问题讨论】:
标签: ios swift swift3 cllocationmanager