Offline Storage

An object conforming to the MGLOfflineRegion protocol determines which
resources are required by an MGLOfflinePack object. At present, only
instances of MGLTilePyramidOfflineRegion may be used as MGLOfflinePack
regions, but additional conforming implementations may be added in the future.

Declaration

MGLOfflineStorage implements a singleton (shared object) that manages offline
packs. All of this class’s instance methods are asynchronous, reflecting the
fact that offline resources are stored in a database. The shared object
maintains a canonical collection of offline packs in its packs property.

Posted by the shared MGLOfflineStorage object whenever an MGLOfflinePack
object encounters an error while downloading. The error may be recoverable and
may not warrant the user’s attention. For example, the pack’s implementation
may attempt to re-request failed resources based on an exponential backoff
strategy or upon the restoration of network access.

Declaration

The key for an NSError object that is encountered in the course of
downloading an offline pack. This key is used in the userInfo dictionary of
an MGLOfflinePackErrorNotification notification. The error’s domain is
MGLErrorDomain. See MGLErrorCode for possible error codes.

Declaration

The key for an NSNumber object that indicates the maximum number of
Mapbox-hosted tiles that may be downloaded and stored on the current device.
This key is used in the userInfo dictionary of an
MGLOfflinePackMaximumMapboxTilesReachedNotification notification. Call
-unsignedLongLongValue on the object to receive the uint64_t-typed tile
limit.

Once this limit is reached, no instance of MGLOfflinePack can download
additional tiles from Mapbox APIs until already downloaded tiles are removed by
calling the -[MGLOfflineStorage removePack:withCompletionHandler:] method.
Contact your Mapbox sales representative to have the limit raised.

Posted by the shared MGLOfflineStorage object when an MGLOfflinePack
object’s progress changes. The progress may change due to a resource being
downloaded or because the pack discovers during the download that more
resources are required for offline viewing. This notification is posted
whenever any field in the progress property changes.