From f9277dda712a081ef5cb2fbe144ef5e33bedd3e5 Mon Sep 17 00:00:00 2001 From: Michael Nachbaur Date: Fri, 24 Apr 2009 12:24:15 -0700 Subject: [PATCH] Since course / speed are only supported in iPhone OS 2.2 and above, check the version number first --- iphone/Classes/Location.m | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/iphone/Classes/Location.m b/iphone/Classes/Location.m index c894b262..68943eab 100755 --- a/iphone/Classes/Location.m +++ b/iphone/Classes/Location.m @@ -74,13 +74,19 @@ - (void)locationManager:(CLLocationManager *)manager fromLocation:(CLLocation *)oldLocation { int epoch = [newLocation.timestamp timeIntervalSince1970]; + float course = -1.0f; + float speed = -1.0f; +#ifdef __IPHONE_2_2 + course = newLocation.course; + speed = newLocation.speed; +#endif NSString * jsCallBack = [NSString stringWithFormat:@"navigator.geolocation.setLocation({timestamp: %d, latitude: %f, longitude: %f, altitude: %f, course: %f, speed: %f, accuracy: {horizontal: %f, vertical: %f}});", epoch, newLocation.coordinate.latitude, newLocation.coordinate.longitude, newLocation.altitude, - newLocation.course, - newLocation.speed, + course, + speed, newLocation.horizontalAccuracy, newLocation.verticalAccuracy ];