Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在ios环境下访问google地图_Ios_Google Maps_Ibm Mobilefirst - Fatal编程技术网

如何在ios环境下访问google地图

如何在ios环境下访问google地图,ios,google-maps,ibm-mobilefirst,Ios,Google Maps,Ibm Mobilefirst,在我的Worklight混合示例应用程序中,我希望在iPhone(IOS)环境中使用google地图。我使用的是Worklight 7.1、Jquery Mobile 1.4.5 我在安卓环境下做过,但在iphone上看不到地图 我的JS代码: var x=document.getElementById("demo"); function getLocation() { if(navigator.geolocation) { navigator.geolocation.getC

在我的Worklight混合示例应用程序中,我希望在iPhone(IOS)环境中使用google地图。我使用的是Worklight 7.1、Jquery Mobile 1.4.5

我在安卓环境下做过,但在iphone上看不到地图

我的JS代码:

var x=document.getElementById("demo");

function getLocation()
  {
  if(navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(position); 
  }
  else{x.innerHTML="Geolocation is not supported by this browser.";}
  }
function showPosition(position)
  {
  x.innerHTML="Latitude: " + position.coords.latitude + 
  "<br>Longitude: " + position.coords.longitude;    
}
var x=document.getElementById(“演示”);
函数getLocation()
{
if(导航器.地理位置){
navigator.geolocation.getCurrentPosition(位置);
}
else{x.innerHTML=“此浏览器不支持地理位置。”;}
}
功能显示位置(位置)
{
x、 innerHTML=“纬度:”+position.coords.Latitude+
“
经度:”+position.coords.Longitude; }
我的HTML:

<!DOCTYPE HTML>
<html>
        <head>
            <meta charset="UTF-8">
            <title>HTMLGeoLocation</title>
            <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
            <link rel="shortcut icon" href="images/favicon.png">
            <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
            <link rel="stylesheet" href="css/HTMLGeoLocation.css">
            <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
            <script>window.$ = window.jQuery = WLJQ;</script>
        </head>
        <body id="content" style="display: none;">
            <!--application UI goes here-->
            <p id="demo">Click the button to get your coordinates:</p>
<button onclick="getLocation()">Try It</button>
            <script src="js/initOptions.js"></script>
            <script src="js/HTMLGeoLocation.js"></script>
            <script src="js/messages.js"></script>
        </body>
</html>

HTMLGeoLocation
window.$=window.jQuery=WLJQ;
单击按钮获取您的坐标:

试试看
有许多在线示例演示了Google地图在Web应用程序中的集成,包括那些使用Worklight客户端框架的应用程序

目前还不清楚您的Worklight版本是什么,因此这里有一些链接供您浏览。它们还为您提供了示例项目,供您检查它们的实现并在本地运行它们


我已经修复了断开的链接。在第二个链接示例项目中,我没有iphone环境,我添加了iphone环境,并且在iphone config.xml文件中添加了任何我想添加的权限/功能。您不需要触摸config.xml