Shefy Gur-ary
Shefy Gur-ary

Reputation: 658

calling maps.app (Apple maps) with navigation using latitude and longitude

I want to call the maps application from my app, and sent it a url with latitude and longitude on source address and destination address (for navigation)

How do I construct the link?

Upvotes: 1

Views: 1015

Answers (1)

Wain
Wain

Reputation: 119041

You should create an instance of MKMapItem and use the openMapsWithItems:launchOptions: method to open the maps app.

Check this reference.


For iOS 5 (which you should think about dropping support for) I think the format was:

[NSString stringWithFormat: @"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f",
                currentLocation.latitude, currentLocation.longitude,
                destinationLocation.latitude, destinationLocation.longitude];

Upvotes: 2

Related Questions