Hi *,
I'm facing a problem with the requestLocation() call on iOS 12.
Normally one requestLocation() call leads to one
event for the locationManager( didUpdateLocations) delegate method.Unfortunately, from time to time there are several events generated, thus the delegate method is called several times.
Is there a way to figure out the very last call of the delegate method? Using the timestamp associated with every location that is forwarded to the delegate method is not an option. That is based on the fact, that one call of the requestLocation() method will generate on event with an already cached location object with a timestamp that is before the time the requestLocation() call was made.
The code with requestLocation() call looks like:
@IBActionfunc getPosition(_ sender: UIButton) {
sender.isEnabled = false
calls = 0
newHeading = nil
clearUI()
locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters
locationManager.activityType = .other
now = Date()
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "HH:mm:ssSSSS"
let timeStr = dateFormatter.string(from: now)
theCurrentTime.text = timeStr
locationManager.requestLocation()
}
Thanks in advance
Peter