Greetings,
I am implementing an app and it has a label that shows user current speed when driving in a car. I did everything to setup location manager and I have made it sure user has provided all the necessary permissions.
Apart from that I have set desiredAccuracy as kCLLocationAccuracyBestForNavigation.
Now the problem is when am travelling in a car with a much higher speed for example 50 km/hr it shows me the speed is 14 km/hr
I have used below code in didUpdateLocations
Multiline
var speed: CLLocationSpeed = CLLocationSpeed()
speed = locationManager.location?.speed ?? 0 * 3.6
if speed > 0{
let speedTxt = String(format: "%.0f km/h", speed)
print(speedTxt)
kmBtn.setTitle("(speedTxt)", for: .normal)
}else{
kmBtn.setTitle("0 Km/h", for: .normal)
}
BlockQuote
NOTE : Here I have multiplied the speed with 3.6 to convert the value from meterPerSecond to KilometerPerHour
Why its not returning the accurate speed and how to get that ?