[英]PhoneGap Geolocation Not Working in iOS
I'm writing an app that will create a chart based on the user's location. 我正在写一个应用程序,它将根据用户的位置创建一个图表。 I need to convert the lat lon coordinates from decimal degrees to geographic coordinates.
我需要将十进制的纬度坐标转换为地理坐标。 I get to the point where the iPhone asks to share it's location with the app.
我到了iPhone要求与应用程序共享其位置的地步。 I'm getting stuck on position.coords.latitude.
我陷入了position.coords.latitude。 I'm getting this in the Weinre debugger:
我在Weinre调试器中得到了这个:
got here Error in Success callbackId: Geolocation1810151147 : TypeError: undefined is not an object (evaluating 'a.type') 到达此处成功回调ID:Geolocation1810151147中的错误:TypeError:undefined不是对象(正在评估'a.type')
function handleLocationPrompt(results) {
if (results.buttonIndex === 1) {
locationStr = results.input1;
window.navigator.geolocation.getCurrentPosition(gotLocation, onError,{
enableHighAccuracy: true});
function gotLocation(position) {
console.log("got here");
var Latitude = position.coords.latitude;
var Longitude = position.coords.longitude;
var mp = webMercatorUtils.webMercatorToGeographic();
var latitude = mp.Latitude.toFixed(3);
var longitude = mp.Longitude.toFixed(3);
var lat = latitude.toString();
var lon = longitude.toString();
var taskParams = {
"Latitude": lat,
"Longitude": lon,
"Location": locationStr
}
window.gp_chart.execute(taskParams, gpChartResultAvailable);
}
function onError(error) {
console.log('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
}
}
could be a timeout issue. 可能是超时问题。 please add timeout to last parameter
请在最后一个参数中添加超时
{ enableHighAccuracy: true,time} {enableHighAccuracy:true,时间}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.