html – Google地图不会显示在Phonegap iOS App中

我有一个PhoneGap iOS应用程序,并且这个 HTML将不会显示应用程序中的地图.我在Safari或FF中完美地看到了地图,但在应用程序中却没有.我该如何让这个工作?
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>

    <script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>  
    <script type="text/javascript">

        $(document).ready(function(){
                    var initialLocation = new google.maps.LatLng(37.654,-77.980);
                        var myOptions = {
                                        zoom: 12,center: initialLocation,mapTypeId: google.maps.MapTypeId.ROADMAP
                        };
                        var map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);
            });
</script>   
</head> 
<body>
<div data-role="content">   
    <!--images go here -->
    <div class="img_shadow" style="padding:4px;">
                    <div id="map_canvas" style="height:130px;"></div>
    </div>
</div>      
</div><!-- /page -->

</body>

解决方法

PhoneGap具有用于外部URL /主机的白名单系统.

从维基:

Also,the latest code has the new white-list feature. If you are
referencing external hosts,you will have to add the host in
PhoneGap.plist under the “ExternalHosts” key. Wildcards are ok. So if
you are connecting to “http://phonegap.com”,you have to add
“phonegap.com” to the list (or use the wildcard “*.phonegap.com” which
will match subdomains as well).

您的上面的代码片段有几个外部主机:

> maps.google.com
> code.jquery.com

也许尝试添加“*”到ExternalHosts开始,以确保不是问题,然后添加更多的特定主机一旦它的工作.

相关文章

vue阻止冒泡事件 阻止点击事件的执行 &lt;div @click=&a...
尝试过使用网友说的API接口获取 找到的都是失效了 暂时就使用...
后台我拿的数据是这样的格式: [ {id:1 , parentId: 0, name:...
JAVA下载文件防重复点击,防止多次下载请求,Cookie方式快速简...
Mip是什么意思以及作用有哪些