HERE SDK for iOS (Premium Edition)

SDK for iOS Developer's Guide

Offline Routing

Even without an active data connection the applications developed with SDK for iOS are able to request routing information to assist travelling from one location to another.

Your application users do not need to maintain active data connections to calculate routes and render them on a map. It is possible to pre-download updated maps and database information for initiating routing requests while offline. For example, if a user has downloaded offline maps of California and Oregon, a route from San Diego to Portland can be created without any data connection.

For more information about downloading offline maps refer to Preloading Map Data.

Force Online or Offline

You can launch online or offline routing without changing the device or HERE SDK connectivity by using connectivity property on an NMACoreRouter instance. The connectivity property can be set to three possible values:
  • If you launch a request using NMACoreRouterConnectivityDefault connectivity mode, the request is performed according to NMAApplicationContext connectivity setting. If the device is offline while NMAApplicationContext is set to online mode, the request fails.
  • If you launch a request using NMACoreRouterConnectivityOnline connectivity mode, an online request is performed regardless of NMAApplicationContext connectivity setting.
  • If you launch a request using NMACoreRouterConnectivityOffline connectivity mode, an offline request is performed using cached data regardless of NMAApplicationContext connectivity setting.
In all cases if the request fails, no fallback action is automatically performed.

To ensure that the connectivity mode is applied, set the connectivity property before launching an NMACoreRouter calculation request. If an NMACoreRouterConnectivityOnline route calculation request fails due to connection issues, HERE SDK returns NMARoutingErrorNetworkCommunication error code. If an NMACoreRouterConnectivityOffline route calculation request fails due to not enough cached data, HERE SDK returns NMARoutingErrorGraphDisconnected error code.

Note: This feature is only applicable to car, bicycle, truck, and pedestrian routing through the NMACoreRouter class.
Note: There is no guarantee that online and offline routes will be the same as different algorithms are used for online and offline route calculation. Online route calculation is performed on high performance servers, therefore more computationally intensive algorithms are used online, which cannot be used offline. Online route calculation should be preferred and offline routes are expected to be used as backup especially when there is no connectivity.