<p>The <a href="http://developer.apple.com/documentation/AppleApplications/Reference/SafariWebContent/UsingiPhoneApplications/chapter_6_section_4.html" rel="nofollow noreferrer">Apple Developer Documentation</a> (link is dead now) explains that if you place a link in a web page and then click it whilst using Mobile Safari on the iPhone, the Google Maps application that is provided as standard with the iPhone will launch.</p>

<p>How can I launch the same Google Maps application with a specific address from within my own native iPhone application (i.e. not a web page through Mobile Safari) in the same way that tapping an address in Contacts launches the map?</p>

<p><strong>NOTE:  THIS ONLY WORKS ON THE DEVICE ITSELF.  NOT IN THE SIMULATOR.</strong></p>

[{'answer_id': 30079, 'author': 'Adam Wright', 'author_id': 1200, 'author_profile': 'https://Stackoverflow.com/users/1200', 'pm_score': 7, 'selected': True, 'text': '<p>For iOS 5.1.1 and lower, use the <code>openURL</code> method of <code>UIApplication</code>. It will perform the normal iPhone magical URL reinterpretation. so</p>\n\n<pre><code>[someUIApplication openURL:[NSURL URLWithString:@"http://maps.google.com/maps?q=London"]]\n</code></pre>\n\n<p>should invoke the Google maps app.</p>\n\n<p>From iOS 6, you\'ll be invoking Apple\'s own Maps app. For this, configure an <code>MKMapItem</code> object with the location you want to display, and then send it the <code>openInMapsWithLaunchOptions</code> message. To start at the current location, try:</p>\n\n<pre><code>[[MKMapItem mapItemForCurrentLocation] openInMapsWithLaunchOptions:nil];\n</code></pre>\n\n<p>You\'ll need to be linked against MapKit for this (and it will prompt for location access, I believe).</p>\n'}, {'answer_id': 30163, 'author': 'davidmytton', 'author_id': 2183, 'author_profile': 'https://Stackoverflow.com/users/2183', 'pm_score': 5, 'selected': False, 'text': '<p>Exactly. The code that you need to achieve this is something like that:</p>\n\n<pre><code>UIApplication *app = [UIApplication sharedApplication];\n[app openURL:[NSURL URLWithString: @"http://maps.google.com/maps?q=London"]];\n</code></pre>\n\n<p>since <a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIApplication_Class/Reference/Reference.html#//apple_ref/occ/clm/UIApplication/sharedApplication" rel="noreferrer">as per the documentation</a>, UIApplication is only available in the Application Delegate unless you call sharedApplication.</p>\n'}, {'answer_id': 347007, 'author': 'Lee', 'author_id': 31063, 'author_profile': 'https://Stackoverflow.com/users/31063', 'pm_score': 0, 'selected': False, 'text': '<p>If you need more flexibility than the Google URL format gives you or you would like to embed a map in your application instead of launching the map app <a href="https://sourceforge.net/projects/quickconnect" rel="nofollow noreferrer">here is an example</a>.</p>\n\n<p>It will even supply you with the source code to do all of the embedding.</p>\n'}, {'answer_id': 530813, 'author': 'Jane Sales', 'author_id': 63994, 'author_profile': 'https://Stackoverflow.com/users/63994', 'pm_score': 5, 'selected': False, 'text': '<p>To open Google Maps at specific co-ordinates, try this code:</p>\n\n<pre><code>NSString *latlong = @"-56.568545,1.256281";\nNSString *url = [NSString stringWithFormat: @"http://maps.google.com/maps?ll=%@",\n[latlong stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];\n[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];\n</code></pre>\n\n<p>You can replace the latlong string with the current location from CoreLocation.</p>\n\n<p>You can also specify the zoom level, using the (”z“) flag. Values are 1-19. Here\'s an example:</p>\n\n<blockquote>\n  <p>[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"<a href="http://maps.google.com/maps?z=8" rel="noreferrer">http://maps.google.com/maps?z=8</a>"]];</p>\n</blockquote>\n'}, {'answer_id': 530858, 'author': 'Jane Sales', 'author_id': 63994, 'author_profile': 'https://Stackoverflow.com/users/63994', 'pm_score': 2, 'selected': False, 'text': "<p>For the phone question, are you testing on the simulator? This only works on the device itself.</p>\n\n<p>Also, openURL returns a bool, which you can use to check if the device you're running on supports the functionality. For example, you can't make calls on an iPod Touch :-)</p>\n"}, {'answer_id': 1731009, 'author': 'Harry Love', 'author_id': 166101, 'author_profile': 'https://Stackoverflow.com/users/166101', 'pm_score': 4, 'selected': False, 'text': '<p>Here\'s the Apple URL Scheme Reference for Map Links: <a href="https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html" rel="noreferrer">https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html</a></p>\n<blockquote>\n<p>The rules for creating a valid map link are as follows:</p>\n<ul>\n<li>The domain must be google.com and the subdomain must be maps or ditu.</li>\n<li>The path must be /, /maps, /local, or /m if the query contains site as the key and local as the value.</li>\n<li>The path cannot be /maps/*.</li>\n<li>All parameters must be supported. See Table 1 for list of supported parameters**.</li>\n<li>A parameter cannot be q=* if the value is a URL (so KML is not picked up).</li>\n<li>The parameters cannot include view=text or dirflg=r.</li>\n</ul>\n</blockquote>\n<p>**See the link above for the list of supported parameters.</p>\n'}, {'answer_id': 1821520, 'author': 'Pavel Kurta', 'author_id': 151793, 'author_profile': 'https://Stackoverflow.com/users/151793', 'pm_score': 1, 'selected': False, 'text': '<p><strong>"g" change to "q"</strong></p>\n\n<pre><code>[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://maps.google.com/maps?q=London"]]\n</code></pre>\n'}, {'answer_id': 3300732, 'author': 'Tex', 'author_id': 398120, 'author_profile': 'https://Stackoverflow.com/users/398120', 'pm_score': 1, 'selected': False, 'text': '<p>If you\'re still having trouble, this video shows how to get "My maps" from google to show up on the iphone -- you can then take the link and send it to anybody and it works.</p>\n\n<p><a href="http://www.youtube.com/watch?v=Xo5tPjsFBX4" rel="nofollow noreferrer">http://www.youtube.com/watch?v=Xo5tPjsFBX4</a></p>\n'}, {'answer_id': 9993743, 'author': 'RAVI', 'author_id': 571219, 'author_profile': 'https://Stackoverflow.com/users/571219', 'pm_score': 0, 'selected': False, 'text': '<p>If you need more flexabilty than the Google URL format gives you or you would like to embed a map in your application instead of launching the map app there is an example found at <a href="https://sourceforge.net/projects/quickconnect" rel="nofollow">https://sourceforge.net/projects/quickconnect</a>.</p>\n'}, {'answer_id': 13861525, 'author': 'Michael Baltaks', 'author_id': 23312, 'author_profile': 'https://Stackoverflow.com/users/23312', 'pm_score': 4, 'selected': False, 'text': '<p>There is also now the App Store Google Maps app, documented at <a href="https://developers.google.com/maps/documentation/ios/urlscheme">https://developers.google.com/maps/documentation/ios/urlscheme</a></p>\n\n<p>So you\'d first check that it\'s installed:</p>\n\n<p><code>[[UIApplication sharedApplication] canOpenURL:\n    [NSURL URLWithString:@"comgooglemaps://"]];</code></p>\n\n<p>And then you can conditionally replace <code>http://maps.google.com/maps?q=</code> with <code>comgooglemaps://?q=</code>.</p>\n'}, {'answer_id': 17022215, 'author': '3shmaoy', 'author_id': 2470609, 'author_profile': 'https://Stackoverflow.com/users/2470609', 'pm_score': 0, 'selected': False, 'text': "<p>iPhone4 iOS 6.0.1 (10A523)</p>\n\n<p>For both Safari &amp; Chrome.\nBoth latest version up till now (2013-Jun-10th).</p>\n\n<p>The URL scheme below also work.\nBut in case of Chrome only works inside the page doesn't work from the address bar.</p>\n\n<p>maps:q=GivenTitle@latitude,longtitude</p>\n"}, {'answer_id': 38436933, 'author': 'Mannam Brahmam', 'author_id': 4720315, 'author_profile': 'https://Stackoverflow.com/users/4720315', 'pm_score': 0, 'selected': False, 'text': '<pre><code>**Getting Directions between 2 locations**\n\n        NSString *googleMapUrlString = [NSString stringWithFormat:@"http://maps.google.com/?saddr=%@,%@&amp;daddr=%@,%@", @"30.7046", @"76.7179", @"30.4414", @"76.1617"];\n    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:googleMapUrlString]];\n</code></pre>\n'}, {'answer_id': 41384444, 'author': 'Ruchin Somal', 'author_id': 6892444, 'author_profile': 'https://Stackoverflow.com/users/6892444', 'pm_score': 3, 'selected': False, 'text': '<h2>If you are using ios 10 then please don\'t forget to add Query Schemes in Info.plist</h2>\n\n<pre><code>&lt;key&gt;LSApplicationQueriesSchemes&lt;/key&gt;\n&lt;array&gt;\n &lt;string&gt;comgooglemaps&lt;/string&gt;\n&lt;/array&gt;\n</code></pre>\n\n<h1><strong><em>If you are using objective-c</em></strong></h1>\n\n<pre><code>if ([[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"comgooglemaps:"]]) {\n    NSString *urlString = [NSString stringWithFormat:@"comgooglemaps://?ll=%@,%@",destinationLatitude,destinationLongitude];\n    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];\n    } else { \n    NSString *string = [NSString stringWithFormat:@"http://maps.google.com/maps?ll=%@,%@",destinationLatitude,destinationLongitude];\n    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:string]];\n    }\n</code></pre>\n\n<h1><strong><em>If you are using swift 2.2</em></strong></h1>\n\n<pre><code>if UIApplication.sharedApplication().canOpenURL(NSURL(string: "comgooglemaps:")!) {\n    var urlString = "comgooglemaps://?ll=\\(destinationLatitude),\\(destinationLongitude)"\n    UIApplication.sharedApplication().openURL(NSURL(string: urlString)!)\n}\nelse {\n    var string = "http://maps.google.com/maps?ll=\\(destinationLatitude),\\(destinationLongitude)"\n    UIApplication.sharedApplication().openURL(NSURL(string: string)!)\n}\n</code></pre>\n\n<h1><strong><em>If you are using swift 3.0</em></strong></h1>\n\n<pre><code>if UIApplication.shared.canOpenURL(URL(string: "comgooglemaps:")!) {\n    var urlString = "comgooglemaps://?ll=\\(destinationLatitude),\\(destinationLongitude)"\n    UIApplication.shared.openURL(URL(string: urlString)!)\n}\nelse {\n    var string = "http://maps.google.com/maps?ll=\\(destinationLatitude),\\(destinationLongitude)"\n    UIApplication.shared.openURL(URL(string: string)!)\n}\n</code></pre>\n'}, {'answer_id': 42642769, 'author': 'DURGESH', 'author_id': 5954633, 'author_profile': 'https://Stackoverflow.com/users/5954633', 'pm_score': 1, 'selected': False, 'text': '<p>For move to Google map use this api and send destination latitude and longitude </p>\n\n<pre><code>NSString* addr = nil;\n     addr = [NSString stringWithFormat:@"http://maps.google.com/maps?daddr=%1.6f,%1.6f&amp;saddr=Posizione attuale", destinationLat,destinationLong];\n\nNSURL* url = [[NSURL alloc] initWithString:[addr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];\n[[UIApplication sharedApplication] openURL:url];\n</code></pre>\n'}, {'answer_id': 47990527, 'author': 'Meet Doshi', 'author_id': 3908884, 'author_profile': 'https://Stackoverflow.com/users/3908884', 'pm_score': 2, 'selected': False, 'text': '<p>Just call this method and add Google Maps URL Scheme into your .plist file same as this <a href="https://stackoverflow.com/a/34492009/3908884">Answer</a>.</p>\n\n<p><strong>Swift-4 :-</strong></p>\n\n<pre><code>func openMapApp(latitude:String, longitude:String, address:String) {\n\n    var myAddress:String = address\n\n    //For Apple Maps\n    let testURL2 = URL.init(string: "http://maps.apple.com/")\n\n    //For Google Maps\n    let testURL = URL.init(string: "comgooglemaps-x-callback://")\n\n    //For Google Maps\n    if UIApplication.shared.canOpenURL(testURL!) {\n        var direction:String = ""\n        myAddress = myAddress.replacingOccurrences(of: " ", with: "+")\n\n        direction = String(format: "comgooglemaps-x-callback://?daddr=%@,%@&amp;x-success=sourceapp://?resume=true&amp;x-source=AirApp", latitude, longitude)\n\n        let directionsURL = URL.init(string: direction)\n        if #available(iOS 10, *) {\n            UIApplication.shared.open(directionsURL!)\n        } else {\n            UIApplication.shared.openURL(directionsURL!)\n        }\n    }\n    //For Apple Maps\n    else if UIApplication.shared.canOpenURL(testURL2!) {\n        var direction:String = ""\n        myAddress = myAddress.replacingOccurrences(of: " ", with: "+")\n\n        var CurrentLocationLatitude:String = ""\n        var CurrentLocationLongitude:String = ""\n\n        if let latitude = USERDEFAULT.value(forKey: "CurrentLocationLatitude") as? Double {\n            CurrentLocationLatitude = "\\(latitude)"\n            //print(myLatitude)\n        }\n\n        if let longitude = USERDEFAULT.value(forKey: "CurrentLocationLongitude") as? Double {\n            CurrentLocationLongitude = "\\(longitude)"\n            //print(myLongitude)\n        }\n\n        direction = String(format: "http://maps.apple.com/?saddr=%@,%@&amp;daddr=%@,%@", CurrentLocationLatitude, CurrentLocationLongitude, latitude, longitude)\n\n        let directionsURL = URL.init(string: direction)\n        if #available(iOS 10, *) {\n            UIApplication.shared.open(directionsURL!)\n        } else {\n            UIApplication.shared.openURL(directionsURL!)\n        }\n\n    }\n    //For SAFARI Browser\n    else {\n        var direction:String = ""\n        direction = String(format: "http://maps.google.com/maps?q=%@,%@", latitude, longitude)\n        direction = direction.replacingOccurrences(of: " ", with: "+")\n\n        let directionsURL = URL.init(string: direction)\n        if #available(iOS 10, *) {\n            UIApplication.shared.open(directionsURL!)\n        } else {\n            UIApplication.shared.openURL(directionsURL!)\n        }\n    }\n}\n</code></pre>\n\n<p>Hope, this is what you\'re looking for. Any concern get back to me. :)</p>\n'}, {'answer_id': 54767602, 'author': 'Abhirajsinh Thakore', 'author_id': 8306054, 'author_profile': 'https://Stackoverflow.com/users/8306054', 'pm_score': 0, 'selected': False, 'text': '<h2>Working Code as on Swift 4:</h2>\n\n<p><strong>Step 1 - Add Following to info.plist</strong></p>\n\n<pre><code>&lt;key&gt;LSApplicationQueriesSchemes&lt;/key&gt;\n&lt;array&gt;\n&lt;string&gt;googlechromes&lt;/string&gt;\n&lt;string&gt;comgooglemaps&lt;/string&gt;\n&lt;/array&gt;\n</code></pre>\n\n<p><strong>Step 2 - Use Following Code to Show Google Maps</strong></p>\n\n<pre><code>    let destinationLatitude = "40.7128"\n    let destinationLongitude = "74.0060"\n\n    if UIApplication.shared.canOpenURL(URL(string: "comgooglemaps:")!) {\n        if let url = URL(string: "comgooglemaps://?ll=\\(destinationLatitude),\\(destinationLongitude)"), !url.absoluteString.isEmpty {\n            UIApplication.shared.open(url, options: [:], completionHandler: nil)\n        }\n    }else{\n        if let url = URL(string: "http://maps.google.com/maps?ll=\\(destinationLatitude),\\(destinationLongitude)"), !url.absoluteString.isEmpty {\n            UIApplication.shared.open(url, options: [:], completionHandler: nil)\n        }\n    }\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/30058', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2183/']