Javascript navigator.geolocation.watchPosition以速度返回NaN
我在iOS上的phonegap/cordova中从GPS获取速度时遇到问题。不管我是开车还是站着不动,它都会回来Javascript navigator.geolocation.watchPosition以速度返回NaN,javascript,ios,cordova,geolocation,gps,Javascript,Ios,Cordova,Geolocation,Gps,我在iOS上的phonegap/cordova中从GPS获取速度时遇到问题。不管我是开车还是站着不动,它都会回来 function speed_start() { speed_timer_id = navigator.geolocation.watchPosition(speed_update_data, speed_update_error,
function speed_start() {
speed_timer_id = navigator.geolocation.watchPosition(speed_update_data,
speed_update_error,
{ enableHighAccuracy: true });
}
var speed_update_data = function(position) {
$("#speed-debug").html('Latitude: ' + position.coords.latitude + '\n' +
'Longitude: ' + position.coords.longitude + '\n' +
'Altitude: ' + position.coords.altitude + '\n' +
'Accuracy: ' + position.coords.accuracy + '\n' +
'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '\n' +
'Heading: ' + position.coords.heading + '\n' +
'Speed: ' + position.coords.speed + '\n' +
'Timestamp: ' + position.timestamp + '\n');
};
var speed_update_error = function(error) {
$("#speed-debug").html(error.message);
}
这是一个硬件“问题”。似乎GPS没有足够的信号