MGLOfflinePack

@interface MGLOfflinePack : NSObject

An MGLOfflinePack represents a collection of resources necessary for viewing a region offline to a local database. It provides an optional MGLOfflinePackDelegate object with progress updates as data or errors arrive from the server.

  • The region for which the pack manages resources.

    Declaration

    Objective-C

    @property (readonly, nonatomic) id<MGLOfflineRegion> _Nonnull region;
  • Arbitrary data stored alongside the downloaded resources.

    The context typically holds application-specific information for identifying the pack, such as a user-selected name.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSData *_Nonnull context;
  • The pack’s current state.

    The state of an inactive or completed pack is computed lazily and is set to MGLOfflinePackStateUnknown by default. If you need the state of a pack inside an MGLOfflinePackListingCompletionHandler, set the delegate property then call the -requestProgress method.

    Declaration

    Objective-C

    @property (readonly, nonatomic) MGLOfflinePackState state;
  • The pack’s current progress.

    The progress of an inactive or completed pack is computed lazily, and all its fields are set to 0 by default. If you need the progress of a pack inside an MGLOfflinePackListingCompletionHandler, set the delegate property then call the -requestProgress method.

    Declaration

    Objective-C

    @property (readonly, nonatomic) MGLOfflinePackProgress progress;
  • The pack’s delegate.

    You can use the offline pack delegate to be notified of any changes in the pack’s progress and of any errors while downloading. For more information, see the MGLOfflinePackDelegate documentation.

    Declaration

    Objective-C

    @property (readwrite, nonatomic, nullable) id<MGLOfflinePackDelegate> delegate;
  • Resumes downloading if the pack is inactive.

    Declaration

    Objective-C

    - (void)resume;
  • Temporarily stops downloading if the pack is active.

    To resume downloading, call the -resume method.

    Declaration

    Objective-C

    - (void)suspend;
  • Request an asynchronous update to the pack’s state and progress properties.

    The state and progress of an inactive or completed pack are computed lazily. If you need the state or progress of a pack inside an MGLOfflinePackListingCompletionHandler, set the delegate property then call this method.

    Declaration

    Objective-C

    - (void)requestProgress;