ios 如何在 Apple Maps 或 Google Maps 中打开链接?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13924829/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to open links in Apple Maps or Google Maps?
提问by Baumr
How can links on websites be made to lead to, firstly, a location in the new Google Maps for iOS app, and if not available, revert to Apple Maps?
如何使网站上的链接首先指向适用于 iOS 的新 Google 地图应用程序中的某个位置,如果不可用,则返回到 Apple 地图?
Currently, the default functionality is that a link to maps.apple.com
will be opened in Apple Maps on iOS, and Google Maps on other devices.
目前,默认功能是maps.apple.com
在 iOS 上的 Apple Maps 和其他设备上的 Google Maps 中打开一个链接。
It'd be good to reverse that on iOS since Google Maps seem to be preferred by most users.
最好在 iOS 上扭转这种情况,因为大多数用户似乎更喜欢 Google 地图。
回答by Jason Whitehorn
I do not think a single URL is going to be able to do that.
我认为没有一个 URL 能够做到这一点。
The Google Maps for iOS uses the comgooglemaps://
schema:
iOS 版 Google 地图使用以下comgooglemaps://
架构:
https://developers.google.com/maps/documentation/ios/urlscheme
https://developers.google.com/maps/documentation/ios/urlscheme
And the Apple Maps app uses http://maps.apple.com
:
Apple Maps 应用程序使用http://maps.apple.com
:
I think the best you are going to be able to do is give the user the choice, or just run with Apple maps since you'll know it's there (if there user-agent is iOS 6).
我认为你能做的最好的事情就是给用户选择,或者只是使用 Apple 地图运行,因为你会知道它在那里(如果用户代理是 iOS 6)。