gpt4 book ai didi

ios - 在 iOS5 中打开原生 map 应用

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:38:55 25 4
gpt4 key购买 nike

您好,我最近不得不使用 cordova 打开设备上安装的本地 map 。到目前为止,这是我所做的:

function getMapsUrl() {
var isAndroid = navigator.userAgent.match(/Android/);
var isIos = navigator.userAgent.match(/(iPhone|iPod|iPad)/);

if (isAndroid) {
return "geo:0,0?q=";
}

if (isIos) {
return "maps:q=";
}

return "http://maps.google.com/maps?q=";
}

此函数在应用程序首次打开时进行评估,并且整个应用程序全局使用一个带有字符串 get's set 的变量来创建链接,根据设备的不同,链接看起来像这样:

 <a href="maps:q=Linie 27, 5405 AR UDEN, Nederland">iOS Version</a>
<a href="geo:0,0?q=Linie 27, 5405 AR UDEN, Nederland">Android Version</a>

这适用于除 iOS5 以外的大多数设备。据我所知,这是因为苹果 map 是在 iOS6 中引入的,而 iOS5 仍然使用谷歌地图。

我已经尝试了所有这些来在 iOS5 上打开本地 map 应用程序,但我没有运气:

  <a href="http://maps.google.com/maps?q=Linie 27, 5405 AR UDEN, Nederland">Android Version Q</a>
br/>
<a href="http://maps.apple.com/maps?q=Linie 27, 5405 AR UDEN, Nederland">iOS Version Q</a>
<br/>
<a href="http://maps.google.com/maps?saddr=Linie 27, 5405 AR UDEN, Nederland">Android Version saddr</a>
<br/>
<a href="http://maps.apple.com/maps?saddr=Linie 27, 5405 AR UDEN, Nederland">iOS Version saddr</a>
<br/>
<a href="maps:q=Linie 27, 5405 AR UDEN, Nederland">iOS curent Version</a>
<br/>
<a href="maps://maps.apple.com/?q=Linie 27, 5405 AR UDEN, Nederland">IOS with google maps</a>
<br/>
<a href="maps:q=Linie 27, 5405 AR UDEN, Nederland">iOS curent Version</a>
<br/>
<a href="comgooglemaps://?q=Linie 27, 5405 AR UDEN, Nederland">From Google Docs for iOS app</a>
<div data-bind="click: WindowOpenClick ">Window.Open</div>
<div data-bind="click: WindowLocationClick">Window.location</div>
<div data-bind="click: WindowOpenClickBlackPage">Window.Open Blank</div>

function WindowOpenClick() {
var mapsUrl = "http://maps.google.com/maps?q=Linie 27, 5405 AR UDEN, Nederland";
window.open(mapsUrl, '_system', 'location=yes');
}

function WindowOpenClickBlackPage() {
var mapsUrl = "http://maps.google.com/maps?q=Linie 27, 5405 AR UDEN, Nederland";
window.open(mapsUrl, '_blank', 'location=yes');
}

function WindowLocationClick() {
var mapsUrl = "http://maps.google.com/maps?q=Linie 27, 5405 AR UDEN, Nederland";
window.location.href = mapsUrl;
}

我添加了上面的所有内容,但它们在我的应用程序中的单独文件中。

有谁知道在 iOS5 中打开 map 应用程序的方法吗?

最佳答案

使用 Google Maps iOS 提到的 URL 方案 comgooglemaps://?q=Linie 27, 5405 AR UDEN, Nederland。检查此 link

关于ios - 在 iOS5 中打开原生 map 应用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19905590/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com