问题
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