このためにデバイスの速度を計算していますデリゲートメソッドを使用しました
(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;
}