Ios5 设备的gps速度

Ios5 设备的gps速度,ios5,cllocationmanager,Ios5,Cllocationmanager,我正在计算设备的速度,为此我使用了委托方法 voidlocationManager:CLLocationManager*管理器didUpdateToLocation:CLLocation*新位置fromLocation:CLLocation*旧位置 但当我在一台设备上测试它时,它并没有显示速度,相反,它总是显示零速度 使用的代码是 - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocatio

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

voidlocationManager:CLLocationManager*管理器didUpdateToLocation:CLLocation*新位置fromLocation:CLLocation*旧位置

但当我在一台设备上测试它时,它并没有显示速度,相反,它总是显示零速度

使用的代码是

- (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吗?我刚刚将gpsspeed显示到类似于此标签的标签中。text=[NSString stringWithFormat:@%f,gpsspeed];当我打印时,它显示-1.000000,这里说负数表示无效速度。也许你的速度不够快,或者它没有足够好的信号来计算你的速度。但我在计算行人的速度…所以也需要做一些小的改变。。。第二,我也没有得到距离。。