How add an application to the “Location Service”?

How do I add my application to the “Location Service” (in the “Privacy and Security” section) of the macOS System Preferences (Sequoia)? (I think the use of MBS plugins is required for this, but which class handles this?). Does anyone have a small example?
Thanks in advance.

I’d like to complete my question because it’s directly related to the topic of the post: how can I automate Info.plist editing in the Xojo IDE?
I need to add two xml keys in Info.plist to activate the macOS localization request, but any manual modification of the file is overwritten at each compilation! Apparently this happens in Build Settings > macOS with a field called “Info.plist Extra” but I can’t find it. Does anyone have any info?

I think first you need the entry in the info.plist and maybe an entitlement.

e.g. for info.plist, you can drop such an info.plist file into the project:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM
"file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
	<key>NSLocationUsageDescription</key>
	<string>Locate your computer</string>

</dict>
</plist>

and in entitlements for hardened runtime, you can set the location checkbox:

Then check our CoreLocation classes.

In CLLocationManagerMBS, you can ask for permissions.

Hi Christian,
For localization, I put this code and it seems to work. I have a localization confirmation dialog box to validate at each execution, but it will be silent once I’ve added my 2 lines to my project’s Info.plist.
Now I have access to the active SSID of my Wi-Fi network (yesterday’s post).

locationManager = New CLLocationManagerMBS

If CLLocationManagerMBS.locationServicesEnabled Then
  locationManager.startUpdatingLocation
Else
  MessageBox("Location services are disabled.")
End If

Many thanks,
Dan