How to open iOS 6 maps from a mobile website?

无人久伴 提交于 2020-02-20 04:51:39

问题


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. I'd rather have this open in a native Apple maps app. How can I do this?

Thanks for all help!


回答1:


Instead of using the previous Google domain maps.google.com you use maps.apple.com. This will remain compatible with older devices running 5.x and below.

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 URL Scheme Reference: Map Links




回答2:


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]];


来源:https://stackoverflow.com/questions/12505451/how-to-open-ios-6-maps-from-a-mobile-website

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