我需要获取设备的速度(米/秒),这是我的代码,速度始终为 0,我不明白。
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
double gpsSpeed2 = newLocation.speed;
labelm.text = [NSString stringWithFormat:@"%f",gpsSpeed2];
}
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.distanceFilter = kCLDistanceFilterNone;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];
谢谢