|
版本: |
BeX5V3.4 |
小版本号: |
|
|
|
数据库: |
MS SQLServer |
服务器操作系统: |
其它(帖子中说明) |
应用服务器: |
Tomcat |
客户端操作系统: |
ios 6.x 以及以上 |
浏览器: |
其它(帖子中说明) |
|
|
如题:
在手机端通过下列代码获取经纬度,
Android手机可以获取到经纬度,而ios手机总是提示:(error.POSITION_UNAVAILABLE)获取位置遇到问题,请确认是否开启了wifi或GPS定位功能!
已经确定ios手机的WIFI、GPS等都已开启,也换了chrome、safri、UC等浏览器,都提示这个。
请问是什么原因导致的呢?谢谢。
JS代码如下:
Model.prototype.modelLoad = function(event) {
var options = {
enableHighAccuracy : true,
maximunAge : 1000,
timeout : 45000
};
if (navigator.geolocation) {
// alert('你的浏览器支持 geolocation ' );
navigator.geolocation.getCurrentPosition(successCallback,errorCallback, options);
} else {
alert('你的浏览器不支持 geolocation');
}
};
function successCallback(position) {
alert("经度:"+position.coords.longitude+",纬度:"+position.coords.latitude);
}
//定位出错处理方式
function errorCallback(error) {
switch (error.code) {
case error.PERMISSION_DENIED:
alert("你拒绝了访问你的位置信息,日报将无法保存!!!");
break;
case error.POSITION_UNAVAILABLE:
alert("获取位置遇到问题,请确认是否开启了wifi或GPS定位功能!!!");
break;
case error.TIMEOUT:
alert("获取位置超时!!!");
break;
}
}
|
|