You’re now watching this thread. If you’ve opted in to email or web notifications, you’ll be notified when there’s activity. Click again to stop watching or visit your profile to manage watched threads and notifications.
You’ve stopped watching this thread and will no longer receive emails or web notifications when there’s activity. Click again to start watching.
My MacOS software uses the Location Services, previously to Ventura the user could allow the app to use or deny the use of location. Now Ventura won't show up my software name there, so the user can't enable/disable it.
My software is a kind of service (main code is terminal) and I have a GUI to setup the parameters.
I can't find any topic related to changes with Ventura. Anyone could help me on this?
Adding something else to this thread. Here a sample code that I use in my original code (not exactly this way, but the main part is quite close)
I started a new Command Line Tool with Xcode 14.2, i notice that there's no more config.plist so I take from my app to ensure that NSLocationAlwaysUsageDescription, NSLocationUsageDescription and NSLocationWhenInUseUsageDescription are there - config.plist attached here too. No luck with Ventura so far.
CFBundleIdentifier
$(PRODUCT_BUNDLE_IDENTIFIER)
NSLocationAlwaysUsageDescription
needs always location
NSLocationUsageDescription
needs location usage
NSLocationWhenInUseUsageDescription
needs when in use location
ProductBuildVersion
1
ProductUserVisibleVersion
1.0.0
UIBackgroundModes
import Foundation
import CoreLocation
struct TCoordinates {
var latitude: Double = 0
var longitude: Double = 0
var altitude: Double = 0
var course: Double = 0
var precision: Double = 0
}
let locationManager = CLLocationManager()
var coordinates: TCoordinates
coordinates = TCoordinates.init()
func getCoordinates(locationManager: CLLocationManager) -> TCoordinates {
var ret = TCoordinates.init()
ret.latitude = locationManager.location?.coordinate.latitude ?? 0
ret.longitude = locationManager.location?.coordinate.longitude ?? 0
ret.altitude = locationManager.location?.altitude ?? 0
ret.course = locationManager.location?.course ?? 0
ret.precision = locationManager.location?.horizontalAccuracy ?? 0
return ret
}
private func locationManager(manager: CLLocationManager!, didChangeAuthorizationStatus status: CLAuthorizationStatus) {
switch status {
case .notDetermined:
// If status has not yet been determied, ask for authorization
manager.requestWhenInUseAuthorization()
break
case .authorizedWhenInUse:
// If authorized when in use
manager.startUpdatingLocation()
break
case .authorizedAlways:
// If always authorized
manager.startUpdatingLocation()
break
case .restricted:
// If restricted by e.g. parental controls. User can't enable Location Services
break
case .denied:
// If user denied your app access to Location Services, but can grant access from Settings.app
break
default:
break
}
}
func getGeoLocation() {
coordinates = getCoordinates(locationManager: locationManager)
if CLLocationManager.locationServicesEnabled() {
let authorizationStatus: CLAuthorizationStatus
if #available(iOS 14, *) {
authorizationStatus = locationManager.authorizationStatus
} else {
authorizationStatus = CLLocationManager.authorizationStatus()
}
switch authorizationStatus {
case .restricted, .notDetermined:
locationManager.requestAlwaysAuthorization()
print("Restricted")
exit(0)
case .denied:
print("Denied")
case .authorizedAlways, .authorizedWhenInUse:
print("Authorized")
case .authorized:
print("Authorized")
@unknown default:
print("Unavailable")
}
}
}
/* -------- */
locationManager.startUpdatingLocation()
getGeoLocation()
autoreleasepool {
RunLoop.main.run()
}