HERE iOS SDK Developer's Guide

Route Serialization

Route serialization is a feature that allows users to use NMARoute methods to serialize a route into NSData, which can be saved as a file. You can also use NMARoute to generate a route from a previously serialized route without going through the route calculation process. This is useful when a user wants to recover from a crash during navigation or when a user wants to transfer a route from another device.

Note: Route serialization is currently offered as a beta feature. APIs may change without notice.

Route serialization currently only supports car, bike, truck, and pedestrian routes. Public Transit, Indoor Venue, and Urban Mobility routes cannot be serialized. Route serialization also does not work when the map version from which a route is serialized does not match the current map version. Route serialization also fails if the binary data containing the serialized route is tempered with or corrupted. In these cases, a specific NMARouteSerializationError error code is returned.

Both asynchronous and synchronous operations are supported. To asynchronously serialize a route, perform the following:

NMARoute* route;
//assume that route calculation was already performed

// asynchronous serialization
[NMARoute serializedRouteWithCompletionBlock^(NSData *data, NSError *error) {
  // do something with the data

To asynchronously deserialize a route:

NSData* data;
//assume 'data' is pointing to a previously-serialized route

[NMARoute routeFromSerializedRoute:data withCompletion:^(NMARoute *restoredRoute, NSError *error) {
  //do something with the restored route