gps设备速度

时间:2012-09-27 10:42:06

标签: ios5 cllocationmanager

我正在计算设备的速度,我使用了委托方法

(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation

但是当我在设备上测试时,它没有显示速度,而是总是显示零速度。

使用的代码是

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{        
    NSLog(@"\nStarting point=%@",startingpoint);
    if (self.startingpoint == nil)
    {
        self.startingpoint = newLocation;
        oldLocation=self.startingpoint;
    }
    //Calculate speed
    double gpsSpeed = newLocation.speed;
}

0 个答案:

没有答案