development

MKDirectionsRequest

An iOS API object that contains routing request data (source, destination, transport type, time preferences) sent from Apple Maps to a routing app.

MKDirectionsRequest is a class in Apple’s MapKit framework that packages all the information a user provides when asking for directions in Apple Maps. When a user selects your routing app as the directions provider, iOS creates an MKDirectionsRequest object and delivers it to your app through its launch URL or app delegate.

What the Request Contains

The object includes the source and destination as map items, the requested transport type (automobile, walking, transit, or any), and optional departure or arrival times. Your app reads these properties to understand the user’s exact navigation needs. For transit apps, the departure and arrival date fields carry special weight because riders often plan trips around specific schedule windows. The transport type indicates which routing mode the user selected so your app can return the correct directions.

Handling the Request in Your App

Your app receives the MKDirectionsRequest when iOS launches it through a URL scheme or universal link. You extract the source and destination coordinates, determine the best route using your own data and algorithms, then present the results in your interface. If the request falls outside your coverage area or your app cannot fulfill it for another reason, display a clear message rather than failing silently. A smooth handoff from Apple Maps builds user trust and encourages repeat usage.