Class

MKDirectionsRequest

The start and end points of a route, along with the planned mode of transportation.

Declaration

@interface MKDirectionsRequest : NSObject

Overview

You use an MKDirectionsRequest object when requesting or providing directions. If your app provides directions, use this class to decode the URL sent to you by Maps. If you need to request directions from Apple, pass an instance of this class to an MKDirections object. For example, an app that provides subway directions might request walking directions to and from relevant subway stations.

For apps that provide directions, you receive direction-related URLs in your app delegate’s application:openURL:sourceApplication:annotation: method. Upon receiving a URL, call the isDirectionsRequestURL: method of this class to determine if the URL is related to routing directions. If it is, create an instance of this class using the provided URL and extract the map items associated with the start and end points.

Topics

Creating a Directions Request Object

isDirectionsRequestURL:

Returns a Boolean indicating whether the specified URL contains a directions request.

initWithContentsOfURL:

Initializes and returns a directions request object using the specified URL.

Accessing the Start and End Points

source

The starting point for routing directions.

setSource:

Sets the starting point of the route.

destination

The end point for routing directions

setDestination:

Sets the end point of the route.

Specifying Transportation Options

transportType

The type of conveyance to which the directions should apply.

requestsAlternateRoutes

A Boolean indicating whether your app wants multiple routes when they are available.

departureDate

The departure date for the trip.

arrivalDate

The arrival date for the trip.

Constants

MKDirectionsTransportType

Constants that specify the type of conveyance to be used.

Launch Options

MKLaunchOptionsCameraKey

The virtual camera to use for viewing the map.

MKLaunchOptionsDirectionsModeDefault

Directions that match the user’s preferred transportation type.

MKLaunchOptionsDirectionsModeDriving

Driving directions between the specified start and end points.

MKLaunchOptionsDirectionsModeKey

The mode of transportation.

MKLaunchOptionsDirectionsModeTransit

Public transit directions between the specified start and end points.

MKLaunchOptionsDirectionsModeWalking

Walking directions between the specified start and end points.

MKLaunchOptionsMapCenterKey

The coordinate value on which to center the map.

MKLaunchOptionsMapSpanKey

The amount of the map to display.

MKLaunchOptionsMapTypeKey

The type of map (standard, satellite, or hybrid) to display.

MKLaunchOptionsShowsTrafficKey

A Boolean value indicating whether to display traffic information.

Relationships

Inherits From

See Also

Directions

MKMapItem

A point of interest on the map.

MKDirections

A utility object that computes directions and travel-time information based on the route information you provide.

MKDirectionsResponse

The route information returned by Apple servers in response to one of your requests for directions.

MKETAResponse

The travel-time information returned by Apple servers.

MKRoute

A single route between a requested start and end point.

MKRouteStep

One portion of an overall route.