On Swift 6 func locationManager( _ manager: CLLocationManager, didUpdateLocations locations: [CLLocation] ) is never called

I did not modify in any way the relative code when porting to Swift 6, still

locationManager(         _ manager: CLLocationManager,         didUpdateLocations locations: [CLLocation]     ) 

is never called, notwithstanding of course there is the property in the info files and all required steps were performed. What did change in Swift 6 hampering the calling of the location callbacks?

I also have a funny error that may be connected: File “com.apple.CoreMotion.plist” may not be opened because you haven't the necessary privileges.

There is nothing in Swift 6 that hampers location callbacks. The switch must have caused a change in your code that could have broken things. It could be a function signature or the containing class change, or perhaps even the startUpdatingLocation() is not called correctly.

It is not possible to guess what might have changed, so you would need to debug the issue.

What is certain is that Swift 6 is not causing the problem, nor is the funny error is related to the issue.

As a matter of fact, albeit that function is not called, for some strange reason at the end of the init function I find the value of the location at self.locationManager.location, for some magical reason, given it should not have had the time to check the location, if of course it was not taken before.

This is the full init:

override init() {
        self.locationManager = CLLocationManager()
        super.init()
        self.locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation
        self.locationManager.distanceFilter = kCLDistanceFilterNone
        self.locationManager.headingFilter = kCLHeadingFilterNone
        self.locationManager.pausesLocationUpdatesAutomatically = false
        self.locationManager.delegate = self
        self.locationManager.startUpdatingHeading()
        self.locationManager.startUpdatingLocation()
        self.locationManager.requestWhenInUseAuthorization()
        self.currentLocation = self.locationManager.location
    }
On Swift 6 func locationManager( _ manager: CLLocationManager, didUpdateLocations locations: [CLLocation] ) is never called
 
 
Q