Launching the iPhone native Maps app with current location

烂漫一生 提交于 2020-01-06 20:14:32

问题


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


回答1:


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

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.



来源:https://stackoverflow.com/questions/8010370/launching-the-iphone-native-maps-app-with-current-location

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!