Meteor GoogleMaps.load()不适用于iOS的Iron
我正在用Meteor在页面上加载一个带有标记的简单地图。 我正在使用GoogleMaps包和Iron 。
地图显示在我的浏览器正确,但是当我尝试了iOS模拟器(iPhone 6 / iOS 8.3)它只是从来没有加载:它是自动运行,系统返回false
在GoogleMaps.loaded()
…
另一方面, Geolocation
正确地返回一个位置。
以下是我设置的存储库以查看整个问题: https : //github.com/Loschcode/meteor-iron-google-maps-issue
重要的行可能是GoogleMaps
包安装程序:
# # Helpers # Template.GeoMap.helpers { geolocationError: => error = Geolocation.error() return error and error.message mapOptions: => latLng = Geolocation.latLng() if (Meteor.isCordova) alert(GoogleMaps.loaded()) # Initialize the map once we have the latLng. if GoogleMaps.loaded() and latLng if (Meteor.isCordova) alert('GoogleMaps.loaded') return { center: new google.maps.LatLng(latLng.lat, latLng.lng) zoom: @MAP_ZOOM } }
过程:
# # onCreated # Template.GeoMap.onCreated => GoogleMaps.load() if (Meteor.isCordova) alert('GoogleMaps.load') # When it's ready, we process the position GoogleMaps.ready 'geoMap', (map) => # THIS IS NEVER FIRED
我不确定这是一个人为的错误还是一个问题,但是我已经有几个小时了,而且我真的不明白
注意:在我的testing回购中,我让一些alert()在iOS上触发,以清楚地看到问题。
对这个问题有什么想法? 对不起CoffeeScript和铁结构。
在Cordova上使用外部API时,需要在项目目录的顶层configurationmobile-config.js文件。
对于谷歌的API,你的手机config.js会像
App.accessRule('*.googleapis.com/*');
文档