Tom Hamming Tom Hamming - 1 year ago 160
Objective-C Question

Programmatically open Maps app in iOS 6

Previous to iOS 6, opening a URL like this would open the (Google) Maps app:

NSURL *url = [NSURL URLWithString:@""];
[[UIApplication sharedApplication] openURL:url];

Now with the new Apple Maps implementation, this just opens Mobile Safari to Google Maps. How can I accomplish the same behavior with iOS 6? How do I programmatically open the Maps app and have it point to a specific location/address/search/whatever?

Answer Source

Found the answer to my own question. Apple documents its maps URL format here. It looks like you can essentially replace with

Update: It turns out that the same is true in MobileSafari on iOS 6; tapping a link to opens the Maps app with that search, the same way did on previous versions. This works and is documented in the page linked above.

UPDATE: This answers my question relating to the URL format. But nevan king's answer here (see below) is an excellent summary of the actual Maps API.