MGLMapSnapshotterDelegate

@protocol MGLMapSnapshotterDelegate <NSObject>

Optional methods about significant events when creating a snapshot using an MGLMapSnapshotter object.

  • Tells the delegate that the snapshotter was unable to load data needed for snapshotting the map.

    This method may be called for a variety of reasons, including a network connection failure or a failure to fetch the style from the server. You can use the given error message to notify the user that map data is unavailable.

    Declaration

    Objective-C

    - (void)mapSnapshotterDidFail:(nonnull MGLMapSnapshotter *)snapshotter
                        withError:(nonnull NSError *)error;

    Swift

    optional func mapSnapshotterDidFail(_ snapshotter: MGLMapSnapshotter, withError error: Error)

    Parameters

    snapshotter

    The snapshotter that is unable to load the data.

    error

    The reason the data could not be loaded.

  • Tells the delegate that the snapshotter has just finished loading a style.

    This method is called in response to -[MGLMapSnapshotter startWithQueue:completionHandler:] as long as the MGLMapSnapshotter.delegate property is set. Changes to sources or layers of the style being snapshotted do not cause this method to be called.

    Declaration

    Objective-C

    - (void)mapSnapshotter:(nonnull MGLMapSnapshotter *)snapshotter
        didFinishLoadingStyle:(nonnull MGLStyle *)style;

    Swift

    optional func mapSnapshotter(_ snapshotter: MGLMapSnapshotter, didFinishLoading style: MGLStyle)

    Parameters

    snapshotter

    The snapshotter that has just loaded a style.

    style

    The style that was loaded.