简体   繁体   English

如何从移动网站打开iOS 6地图?

[英]How to open iOS 6 maps from a mobile website?

I have a mobile website that I've had a link to open Google maps app from within my website. 我有一个移动网站,我有一个链接从我的网站打开谷歌地图应用程序。 Now however with the new version of ios6, the native version of google maps is no more and now the link opens to a safari based google maps. 现在使用新版本的ios6,谷歌地图的原生版本已不复存在,现在该链接将打开基于野生动物园的谷歌地图。 I'd rather have this open in a native Apple maps app. 我宁愿在原生Apple地图应用程序中打开它。 How can I do this? 我怎样才能做到这一点?

Thanks for all help! 谢谢大家的帮助!

Instead of using the previous Google domain maps.google.com you use maps.apple.com . 您可以使用maps.apple.com而不是使用之前的Google域maps.google.com This will remain compatible with older devices running 5.x and below. 这将与运行5.x及更低版本的旧设备保持兼容。

It looks like this: 它看起来像这样:

http://maps.apple.com/maps?q=cupertino

Most of the parameters are the same, but see the Apple docs for more details: 大多数参数都相同,但有关详细信息,请参阅Apple文档:

Apple URL Scheme Reference: Map Links Apple URL方案参考:地图链接

what do you want ? 你想要什么 ?

open maps web safari or open maps app ? 打开地图网络野生动物园或开放地图应用?

try this 试试这个

CLLocation * currentLocation;
NSURL *requestUrl;
CLLocationCoordinate2D storedLocation;


CLLocationCoordinate2D start = { (storedLocation.latitude), (storedLocation.longitude) };

//Bitiş Yeri
CLLocationCoordinate2D end = { ([koordinatX floatValue]), ([koordinatY floatValue]) };

NSString *googleMapsURLString = [NSString stringWithFormat:@"http://maps.google.com/?saddr=%1.6f,%1.6f&daddr=%1.6f,%1.6f", start.latitude, start.longitude, end.latitude, end.longitude];

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:googleMapsURLString]];

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

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