I'm writing an OSX app in swift 3 that uses CLLocationManager, according to the docs and all the examples I've found the following should be fine (this is in a class that that is a CLLocationManagerDelegate)
if CLLocationManager.locationServicesEnabled() {
let lm = CLLocationManager()
lm.requestWhenInUseAuthorization()
lm.delegate = self
lm.desiredAccuracy = kCLLocationAccuracyNearestTenMeters
lm.startUpdatingLocation()
print("should start getting location data")
} else {
print("Location service disabled");
}
but it seems requestWhenInUseAuthorization (and requestAlwaysAuthorization) aren't available to OSX. I've currently got those function calls wrapped in #if blocks:
#if os(macOS)
// can't find way for MacOSX to request auth
#endif
#if os(watchOS) || os(tvOS)
lm.requestWhenInUseAuthorization()
#endif
#if os(iOS)
lm.requestAlwaysAuthorization()
#endif
So does anyone know how to get this working in a macOS desktop application?