Passing a String from my app to Apple Maps so that it can Search

apple maps url scheme
open apple maps with address swift
open apple maps from app swift 4
ios open maps app with directions
how to open maps app programmatically with address in swift?
ios open google maps app with directions
how to search for location and display results using apple’s mapkit swift
apple maps url scheme ios

I'm trying to figure out the best way of going about passing a string value to apple maps so that I can search it. I'm working on an application in class that pulls a random string from an array and I want to be able to call apple maps that is already on the device and search whatever string is selected. I've looked up MKLocalSearchRequest and I think that may be the easiest option I'm just not sure how to integrate it with Apple Maps instead of using it with a mapkitview inside of the app. This is a method I found that seems like it could work I'm just not sure how to declare it.

 class func openMaps(with mapItems: [MKMapItem], 
 launchOptions: [String : Any]? = nil) -> Bool
import CoreLocation

Then in viewDidLoad:

    let geocoder = CLGeocoder()

    let locationString = "London"

    geocoder.geocodeAddressString(locationString) { (placemarks, error) in
        if let error = error {
            print(error.localizedDescription)
        } else {
            if let location = placemarks?.first?.location {
                let query = "?ll=\(location.coordinate.latitude),\(location.coordinate.longitude)"
                let urlString = "http://maps.apple.com/".appending(query)
                if let url = URL(string: urlString) {
                    UIApplication.shared.open(url, options: [:], completionHandler: nil)
                }
            }
        }
    }

Passing a String from my app to Apple Maps so that it can Search, import CoreLocation. Then in viewDidLoad : let geocoder = CLGeocoder() let locationString = "London" geocoder. Healthcare providers, labs, and other businesses that would like to provide information on COVID-19 testing locations can now do so through Apple Business Register. Learn More Add or update your business information in Apple Maps to help customers find you.

You have many option to do that:

import MapKit

First

UIApplication.shared.openURL(NSURL(string:
    "comgooglemaps://?saddr=&daddr=\(place.latitude),\(place.longitude)&directionsmode=driving")! as URL)

Or

@IBAction func action(_ sender: Any) {
    let latitude: CLLocationDegrees = 37.2
    let longitude: CLLocationDegrees = 22.9

    let regionDistance:CLLocationDistance = 10000
    let coordinates = CLLocationCoordinate2DMake(latitude, longitude)
    let regionSpan = MKCoordinateRegionMakeWithDistance(coordinates, regionDistance, regionDistance)
    let options = [
        MKLaunchOptionsMapCenterKey: NSValue(mkCoordinate: regionSpan.center),
        MKLaunchOptionsMapSpanKey: NSValue(mkCoordinateSpan: regionSpan.span)
    ]
    let placemark = MKPlacemark(coordinate: coordinates, addressDictionary: nil)
    let mapItem = MKMapItem(placemark: placemark)
    mapItem.name = "Place Name"
    mapItem.openInMaps(launchOptions: options)
    }

Map Links, Map Links. The maps URL scheme is used to show geographical locations and to generate driving directions between two points. If your app  Hello, I'm confused why my routing app does not appear in Maps app as a valid routing application. It does not appear even among AppStore routing apps, despite the fact, that when I install my app signed with AdHoc provisioning profile, it appears as routing app in Apple Maps application like nothing was bad.

Swift 4

Use this:

UIApplication.shared.open(URL(string:"http://maps.apple.com/?address=yourAddress")!)

How to launch Google Maps or Apple Maps from an iOS app with Swift, In need a sample code hoe to launch Google Maps or Apple Maps with Swift thx. Activity · Home · Content · People; Search So i want to give the users an option to choose between googemaps en apple maps to get directions from the current canOpenURL(NSURL(string:"http://maps.apple.com")!)) { I'm trying to figure out the best way of going about passing a string value to apple maps so that I can search it. I'm working on an application in class that pulls a random string from an array an

How to search for location and display results using Apple's MapKit, Maps contain a lot of information, so it's natural for users to search for places. The pin will have a callout button that app-switches to Apple Maps for driving The cell's detailTextLabel is set to an empty string for now. Then you pass the placemark to the map controller via the custom protocol method. How to delete search history from Apple Maps To clear the searches you’ve made on the Apple Maps, this is what you need to do. On your iPhone’s homescreen, open the Apple Maps app.

Google Maps URL Scheme for iOS | Maps URLs, You can use the Google Maps URL scheme to launch the Google Maps app openURL(URL(string:"https://www.google.com/maps/@42.585444,13.007813,6z​")!) You can set options in the URL that will be passed to the launched application. An example URL is below to search for “Pizza” around the specified location:. Hi, Let me summarize the situation first. In my application users can list the locations on the map and see their own locations. What I need is launching to the native Map application (in this case Apple map), passing the source and destination locations (geo points) and ask to give directions to get to the destination.

How to look up a location with MKLocalSearch.Request, First, import the MapKit framework, then create an instance of MKLocalSearch. That provides no other information to Apple other than the text string, so it will look location, then passing the region they are looking at to your search: run on your application's main thread, so you can present some user  I happened to catch sight of an Apple Maps Car passing by my office window this morning. I Tweeted an image of the vehicle and this attracted lots of interest, so I had a little look to see what I could find.

Comments
  • Possible duplicate of Open Apple Maps programmatically in iOS8, Xcode 7, Swift 2
  • @rbaldwin I looked at that one and it didn't seem to help me at all
  • @CalebBartholomew if it's a string value you can use approach rbaldwin suggested, check more about Map Link in documentation although it's old it's still working.
  • @NajdanTomić the documentation link you gave me worked perfectly with what rbaldwin gave me. I was able to piece it together with that. Thank you so much
  • This worked perfectly in combination with the above documentation. Thank you
  • Lets say I'm using mapItem.name = "Taco Bell" whenever I perform the search it takes me out to a random place in the ocean. Is there no way to have it just automatically search around you?