Instance Method

calculateDirectionsWithCompletionHandler:

Begins calculating the requested route information asynchronously.

Declaration

- (void)calculateDirectionsWithCompletionHandler:(MKDirectionsHandler)completionHandler;

Parameters

completionHandler

The block to execute when the directions are ready or when an error occurs. This parameter must not be nil.

Discussion

This method initiates the request for directions and calls your completion handler block with the results. Your completion handler is executed on your app’s main thread. The implementation of your handler should check for errors and then incorporate the response data as appropriate.

If you call this method while a previous request is in process, this method calls your completion handler with an error. You can determine if a request is in process by checking the value of the calculating property. You can also cancel a request as needed.

See Also

Getting the Directions

MKDirectionsHandler

The block to use for processing the requested route information.

MKDirectionsResponse

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