使用当前位置启动iPhone本机Maps应用 [英] Launching the iPhone native Maps app with current location

查看:76
本文介绍了使用当前位置启动iPhone本机Maps应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里看到了很多有关如何启动Maps应用程序的代码示例,但没有一个真正启动本机应用程序,它们全都在Safari上启动Google的网站(

I've seen a lot of code samples here on how to launch the Maps app but none of them actually launch the native app, they all launch Google's website on Safari instead (http://maps.google.com...). I've seen an app before, can't recall the name, that launched the iPhone maps application itself and on the address bar of the apps it has a string that looked like "hotel loc:XX.XXXX, XX.XXXX" which would select the current location on the map based on the coordinates provided on the address and pin point all hotels in the nearby area (visible area). I'm positive that it launched the native app because all the app settings were there and of course the app was among the running apps on the phone and safari wasn't open. I looked at the MapKit but wasn't able to pass that address to it from code ("hotel loc:longitude, latitude"). Does any of you guys happen to know how to launch the actual native app and pass an address to it?

https://developer.apple.com/library /archive/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html

推荐答案

从应用程序内部启动的,符合开发人员文档中条件的URL将在地图"应用程序中打开.这是一个关键的区别,因为在大多数应用程序中,您使用自定义URL方案,而对于地图,您只需为maps.google.com

URLs launched from within an app that fulfil the criteria in the developer document will open up in the Maps application. This is a key difference, because in most applications you use a custom URL scheme, whereas for the maps you simply fire up a URL for maps.google.com

但是,如果您a)不遵循该文档中的规范,或者b)在模拟器中运行,则将转到Safari中的Google Maps网页.

However, if you a) don't follow the specs in that document to the letter, or b) are running in the simulator, you'll go to the Google Maps web page in Safari.

这篇关于使用当前位置启动iPhone本机Maps应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆