我写的代码在浏览器上运行得非常好。但是当我在iPhone上连接到wifi时,在调试器中出现错误: Javascript错误 - 无法找到变量:googleJavascript错误 - 无法找到变量:google
每当我调用任何Google地图/方向/ geoLocation对象时,都会发生这种情况。
的代码如下:
map = new Ext.Map({
mapOptions : {
center : center,
zoom : 20,
// mapTypeId : google.maps.MapTypeId.ROADMAP,
navigationControl: true,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.DEFAULT
}
},
listeners : {
maprender : function(comp, map){
pos = new google.maps.LatLng(lats, longs, true);
var marker = new google.maps.Marker({
position: pos,
//title : 'Sencha HQ',
map: map
});
map.setMapTypeId(google.maps.MapTypeId.HYBRID);
setTimeout(function(){map.panTo (pos);} , 1000);
}
},
geo:new Ext.util.GeoLocation({
autoUpdate:true,
maximumAge: 0,
timeout:2000,
listeners:{
locationupdate: function(geo) {
pos = new google.maps.LatLng(lats, longs, true);
center = new google.maps.LatLng(geo.latitude, geo.longitude);
if (map.rendered)
map.update(center)
else
map.on('activate', map.onUpdate, map, {single: true, data: pos});
},
locationerror: function(geo, bTimeout, bPermissionDenied, bLocationUnavailable, message) {
if(bLocationUnavailable){
alert('Your Current Location is Unavailable on this device');
}
else if (bPermissionDenied){
alert('Location capabilities have been disabled on this device.');
}
}
}
})
});
每当码遇到字谷歌会出现错误。也为经纬度对象我得到的JavaScript错误:“......没有经纬度构造的结果”
注:变量‘拉特’和‘多头’这部分的代码
之前已经n定义的给定值
之前,你可以检查你包括外部谷歌API库? – ManseUK
@ManseUK你是什么意思由外部谷歌API的lib?我在index.html的脚本标记中添加了如下内容:' ' – SashaZd