Open Apple Maps programmatically

swift open apple maps with directions
ios open google maps app with directions
open apple maps with address swift 4
ios open maps app with directions
apple maps url scheme
open location in google maps ios
swift open google maps with address
can't use comgooglemaps://

I want to open the Apple Maps App in my own Swift App, but I have only zipcode, city & street. I have NO Coordinates. I researched a lot, but there were only ways with using coordination information.

You can just pass your address information as URL parameters in the URL with which you open the maps app. Say you wanted the maps app to open centered on The White House.

UIApplication.sharedApplication().openURL(NSURL(string: ",PennsylvaniaAve.,20500")!)

The Maps app opens with the ugly query string in the search field but it shows the right location. Note that the city and state are absent from the search query, it's just the street address and the zip.

A potentially better approach, depending on your needs, would be to get the CLLocation of the address info you have using CLGeocoder.

let geocoder = CLGeocoder()
let str = "1600 Pennsylvania Ave. 20500" // A string of the address info you already have
geocoder.geocodeAddressString(str) { (placemarksOptional, error) -> Void in
  if let placemarks = placemarksOptional {
    print("placemark| \(placemarks.first)")
    if let location = placemarks.first?.location {
      let query = "?ll=\(location.coordinate.latitude),\(location.coordinate.longitude)"
      let path = "" + query
      if let url = NSURL(string: path) {
      } else {
        // Could not construct url. Handle error.
    } else {
      // Could not get a location from the geocode request. Handle error.
  } else {
    // Didn't get any placemarks. Handle error.

How to open maps App programmatically with , If you want to launch a seperate app then ignore this. Google maps: Add a web view to your app and load a "map.html" file from your bundle that  In watchOS 1 there isn't a way to open Maps from a button press. If you display a WKInterfaceMap of the location in your app, however, tapping it will opens the Maps app centred on the location your map was displaying.

Using Swift 4 and Xcode 9

At the top:

import CoreLocation


let geocoder = CLGeocoder()

let locationString = "London"

geocoder.geocodeAddressString(locationString) { (placemarks, error) in
    if let error = error {
    } else {
        if let location = placemarks?.first?.location {
            let query = "?ll=\(location.coordinate.latitude),\(location.coordinate.longitude)"
            let urlString = "".appending(query)
            if let url = URL(string: urlString) {
      , options: [:], completionHandler: nil)

How to launch Google Maps or Apple Maps from an iOS app with Swift, Or show a location? You could do something like this: UIApplication.​sharedApplication().openURL(NSURL(string: "​  Open Apple Maps programmatically at | Latest informal quiz & solutions at programming language problems and solutions of java,jquery,php,

Swift 4 and above
     let myAddress = "One,Apple+Park+Way,Cupertino,CA,95014,USA"
    if let url = URL(string:"\(myAddress)") {

Apple has a Documentation about the Map URL Scheme. Look here:

Opening Maps Programmatically : swift, Open location in Apple Maps using Swift. GitHub Gist: instantly share code, notes​, and snippets. If you use then it will open the map in safari for every ios. If you use then it will open the map in map application of ios 6 and also work greate with ios 5 and in ios 5 it open the map as normal in safari.

Open location in Apple Maps using Swift. · GitHub, Launch the Google Maps app for iOS and perform a specific function. Note: Beginning with iOS 9, your app must declare the URL schemes that it will open. See  How to open maps App programmatically with coordinates in swift? Programmatically open Maps app in iOS 6. 10. Open Apple Maps with latitude and longitude

Google Maps URL Scheme for iOS | Maps URLs, In this video, I show you how to launch maps navigation from within your own app​. This is Duration: 10:26 Posted: Feb 1, 2017 If you would prefer to display map information in the Maps app as opposed to your own app, you can launch Maps programmatically using one of two techniques: In iOS 6 and and OS X v10.9 and later, use an MKMapItem object to open Maps. In iOS 5 and earlier, create and open a specially formatted map URL as described in Apple URL Scheme Reference.

How To Launch Maps Navigation From Your App In Xcode 8 (Swift 3 , In iOS 8, Apple Maps officially replaced the Google-based map data with data provided primarily by a company named TomTom (but also including technology​  Integrating with Apple Maps. Give your apps and website a sense of place with maps and location information. Present maps with custom annotations, highlighted regions, and overlays.

  • You could use Google's Geocoding API to convert your address to coordinates
  • Instead of using commas to separate words in the string, you can you %20 instead of spaces so for example "1600%20Pennsylvania%20Ave.%2020500" will work for the first option of your answer and will open in maps like "1600 Pennsylvania Ave. 20500"
  • @geraldWilliam can you update for Swift 3-4?