google-maps - 谷歌地图不显示在手机上

标签 google-maps google-maps-api-3 meteor

大家好,我正在使用meteor-google-map。我可以在桌面上看到它们,但在移动设备上看不到它们。谁能告诉我我做错了什么?在移动设备上, map 容器全是空白的。这是一张图片

map not appearing

如果我必须将域列入白名单,那么有人可以告诉我如何将谷歌地图列入白名单,因为来自文档

tel:, geo:, mailto:, sms:, market:* are allowed and launch externally (phone app, or an email client on Android)

我认为谷歌地图是允许的

这是谷歌地图代码

index.html

  <div class="map-container">
    {{> googleMap name="exampleMap" options=exampleMapOptions}}
  </div>

index.js

    exampleMapOptions: function() {
    // Make sure the maps API has loaded
    if (GoogleMaps.loaded()) {
      // Map initialization options
      return {
        center: new google.maps.LatLng(Meteor.user().profile.latitude, Meteor.user().profile.longitude),
        zoom: 13
      };
    }
  }

Template.body.onCreated(function() {
  // We can use the `ready` callback to interact with the map API once the map is ready.
  GoogleMaps.ready('exampleMap', function(map) {
    // Add a marker to the map once it's ready
    var marker = new google.maps.Marker({
      position: map.options.center,
      map: map.instance
    });
  });
});

更新

我发现我遇到了错误“ Uncaught ReferenceError :谷歌未定义”

所以我尝试了白名单,但它不起作用

> App.info({   id: 'com.example.matt.uber',   
>name: 'MedCircle',  
> description: 'Get über power in one button click',   
>author: 'Matt
> Development Group',   
>email: '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="660509081207051226031e070b160a034805090b" rel="noreferrer noopener nofollow">[email protected]</a>',   
>website: 'http://example.com' 
>}); 
> 
> App.setPreference('BackgroundColor', '0xff0000ff');
> App.setPreference('HideKeyboardFormAccessoryBar', true);
> App.setPreference('Orientation', 'default');
> 
> 
> // App.accessRule('*.googleapis.com'); 
> //App.accessRule('*.gstatic.com'); 
>// App.accessRule('*.google.com'); //
>// App.accessRule('maps.googleapis.com'); 
>// App.accessRule('maps.gstatic.com'); 
>// App.accessRule('mt0.googleapis.com'); 
>// App.accessRule('mt1.googleapis.com'); 
>// App.accessRule('csi.gstatic.com');
> 
> 
> // <access origin="*://*.googleapis.com/*" subdomains="true" /> 
> //<access origin="*://*.gstatic.com/*" subdomains="true" /> 
> // <accessorigin="*://*.google.com/*" subdomains="true" /> 
> // <accessorigin="*://*.googleusercontent.com/*" subdomains="true" />
> 
> App.accessRule('*');

最佳答案

我发现我必须允许这些

App.accessRule('http://*');
App.accessRule('https://*');

关于google-maps - 谷歌地图不显示在手机上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33101792/

相关文章:

ios - 我如何使用谷歌地图构建跟踪其他 gps 用户功能?

javascript - Meteor.http 方法在服务器上未定义?

node.js - 使用设置参数在 Node 下运行 Meteor Build

Android 谷歌地图 api v2 - 缺少 Google Play 服务

javascript - MarkerWIthLabel map 库 : this. setValue 不是函数

安卓.view.InflateException : Binary XML file line #30: Error inflating class <unknown>

php - 使用 Google Map API v3 提供的 DirectionsService 查找并显示最近标记的路线

php - 谷歌地图实现导致谷歌页面速度问题

google-maps - 在谷歌地图API中设置draggablecursor属性的语法

mongodb - 为什么 Meteor v0.4.x (MongoDB?) 曾经为一个非常简单的应用程序占用约 3GiB 的磁盘空间?