I have a code that redirects the user to Google Maps or Apple Maps by pressing the map , when Apple Maps is uninstalled, an alert appears asking the user to download Apple Maps and redirects the user to the App Store, when I select Show in App Store, the user is redirected to App Store, and then the alert is shown again.
func openMaps() {
let coordinate = CLLocationCoordinate2D(latitude: 52.5162746, longitude: 13.3755153)
let mapItem = MKMapItem(placemark: MKPlacemark(coordinate: coordinate))
mapItem.name = "Test"
mapItem.openInMaps(launchOptions: [MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDefault])
}