Location updates in iOS 15 is giving bad coordinates when indoors.

I am working on an App that tracks location coordinates from a starting point to an end point and calculates the mileage of the route. The location manager is set with a distance filter of 10, desired accuracy is kCLocationAccuracyBestForNavigation, pausesLocationUpdatesAutomatically is false. In the locationUpdated function of the location listener, I filter out coordinates with horizontalAccuracy greater than 100.

The problem is that, in iOS 15, if the route is indoors (wifi based location tracking), locationUpdated function gets called with inaccurate location values with good horizontalAccuracy value. For example, even when the device is stationary, it gets a stream of locations with distances varying from 60m to 100m from the previous location in the stream. As a result, the calculated mileage becomes inaccurately inflated. I tested with larger distance filter (e.g. 50m, 80m, 100m), but the issue persists.

The same code works perfectly, both indoors and outdoors, in iOS 14.8. The locationUpdated function gets called with accurate location value after the device has moved the distance set in the distance filter. Why I am getting bad location values in iOS 15 and is there a known solution to it?

Location updates in iOS 15 is giving bad coordinates when indoors.
 
 
Q