I'm trying to create a link from a restaurant annotation on a map in my app (created using MapKit) that will open the Apple Maps app on an iphone. I've been using the Restaurant name, telephone number, and coordinates and cannot get applemaps to open the enhanced page (which contains photographs and customer reviews and is much more descriptive than the page that is opening, which only shows the location on a map with the phone number and coordinates. It is not that descriptive, and I'm trying to create a request that will make it very easy to jump back and forth between my app and the enhanced page on apple maps. here's what I'm using in my request: " private func openInAppleMaps() {
let coordinate = CLLocationCoordinate2D(latitude: restaurant.latitude, longitude: restaurant.longitude)
let placemark = MKPlacemark(coordinate: coordinate)
let mapItem = MKMapItem(placemark: placemark)
mapItem.name = restaurant.name
if let phone = restaurant.telephone1 {
mapItem.phoneNumber = phone
}
mapItem.openInMaps(launchOptions: [MKLaunchOptionsShowsTrafficKey: true])
}
}" the entire file is attached. Any help or advice would be much appreciated.
You can display many details of a point of interest with a similar presentation to what is seen inside the Apple Maps app by using the feature selection family of APIs. We have a sample code project that shows what's possible, and everything shown in that sample has a SwiftUI equivalent API that you can use. Once you're using those APIs, your customers can jump into the Maps app through a button that is automatically included in the UI provided by those APIs.
—Ed Ford, DTS Engineer