简体   繁体   中英

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

Thanks for all help!

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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