简体   繁体   English

iOS 6.0地图应用的URL方案是什么?

[英]What is the URL scheme for the iOS 6.0 maps app?

Previously, within an iOS app you could launch the Maps app from within your application by using the Google Maps URL scheme (http:maps.google.whatever.whatever). 以前,在iOS应用中,您可以使用Google Maps URL方案(http:maps.google.whatever.whatever)从应用程序中启动Google地图应用。

Does anyone know what the new URL scheme for the iOS 6.0 Maps app is? 有谁知道iOS 6.0地图应用程序的新URL方案是什么? I can't find any new documentation on this. 我找不到任何关于此的新文档。

You need to use MKMapItem to open the maps application. 您需要使用MKMapItem打开地图应用程序。 Take a look at the documentation: Documentation 看一下文档: 文档

Here's how to use it: 以下是如何使用它:

MKMapItem *mapItem=[[MKMapItem alloc] initWithPlacemark:yourPlacemark];
[mapItem openInMapsWithLaunchOptions:@{MKLaunchOptionsMapTypeKey : @(yourMapType), MKLaunchOptionsShowsTrafficKey : @(yourTraffic), MKLaunchOptionsDirectionsModeKey : yourDirectionMode}];

While you will get more control by using an MKMapItem , the URL scheme is far easier. 虽然您将通过使用MKMapItem获得更多控制,但URL方案更容易。 It hasn't changed much, you just replace google.com with apple.com. 它没有太大变化,你只需用apple.com取代google.com即可。 Here's the documentation . 这是文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM