MGLOfflinePackDelegate

@protocol MGLOfflinePackDelegate <NSObject>

The MGLOfflinePackDelegate protocol defines methods that a delegate of an MGLOfflinePack object can optionally implement to be notified of any changes in the pack’s download progress and of any errors while downloading.

  • Sent whenever the pack’s state or download progress changes. Every change to a field in the progress property corresponds to an invocation of this method.

    Declaration

    Objective-C

    - (void)offlinePack:(nonnull MGLOfflinePack *)pack
        progressDidChange:(MGLOfflinePackProgress)progress;

    Parameters

    pack

    The pack whose state of progress changed.

    progress

    The updated progress. To get the updated state, refer to the state property.

  • Sent whenever the pack encounters an error while downloading.

    Download errors may be recoverable. For example, this pack’s implementation may attempt to re-request failed resources based on an exponential backoff strategy or upon the restoration of network access.

    Declaration

    Objective-C

    - (void)offlinePack:(nonnull MGLOfflinePack *)pack
        didReceiveError:(nonnull NSError *)error;

    Parameters

    pack

    The pack that encountered an error.

    error

    A download error. For a list of possible error codes, see MGLErrorCode.

  • Sent when the maximum number of Mapbox-hosted tiles has been downloaded and stored on the current device.

    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.

    Declaration

    Objective-C

    - (void)offlinePack:(nonnull MGLOfflinePack *)pack
        didReceiveMaximumAllowedMapboxTiles:(uint64_t)maximumCount;