[Core Location] Warning regarding method invoked on main thread may cause UI unresponsivness

Hello, I am currently working on an application that uses the MapKit framework as well as Core Location. Since the upgrade to IOS 16, I have been continuously getting the warning "This method can cause UI unresponsiveness if invoked on main thread. instead consider waiting for '-locationManagerDidChangeAuthorization' callback and checking 'authorizationStatus' first".

Here is some history and what I did so far. I first noticed this warning on the "locationServicesEnabled" method within CLLocationManager. I was able to solve this issue by exactly as the warning was suggesting, sending the "locationServicesEnabled" call off the main thread by using dispatch async and global queues.

Initially this solved my problem, but I noticed when I start the app with "Location Services disabled or at Never" on my device the warning still appears, but only on those cases. If the app starts and the user has their Location Services on, the app will request "Location request When in Use" as expected and no warning will appear.

I believe MapView uses CLLocationManager in the background as a private class [MKLocationManager]. I am not sure if that what is causing the issue, but at least with the "locationServicesEnabled" warning the warning pointed to where I was calling it, now it's simply pointing to the main method of the application itself. If anyone has encountered this issue, any help would be greatly appreciated!

Issue navigator:
CLClientsIsLocationServicesEnabled
[MKLocationManager isLocationServicesPossiblyAvailable]

See this post for a similar issue, and specifically the last point in my breakdown.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thank you so much Quinn for the reply! Greatly appreciated.

[Core Location] Warning regarding method invoked on main thread may cause UI unresponsivness
 
 
Q