Why is my CLLocation speed so inaccurate?

前端 未结 2 2023
遇见更好的自我
遇见更好的自我 2021-01-03 11:30

I´m playing a bit with the iPhone SDK and I want to show the current speed in my application. There are so many apps that can do that really precise, especially for low spee

2条回答
  •  花落未央
    2021-01-03 12:16

    Please try following in your code :

    speedLabel.text = [NSString stringWithFormat:@"SPEED(Km/Hr): %f", [location speed]*3.6];
    latitudeLabel.text = [NSString stringWithFormat:@"LATITUDE: %f", location.coordinate.latitude];
    longitudeLabel.text = [NSString stringWithFormat:@"LONGITUDE: %f", location.coordinate.longitude];
    CLLocationDistance meters = [location distanceFromLocation:orginalLoc];
    distanceLabel.text = [NSString stringWithFormat:@"DISTANCE(M): %f", meters];
    

提交回复
热议问题