Class YMKOfflineCacheManager

Attention.

This feature is not available in the free MapKit version.

Offline cache manager.

There are a number of asynchronous operations that shouldn't be executed simultaneously. When multiple operations from the following list are executed in parallel- there's no guarantee that they will take effect in the order they were issued: computeCacheSizeWithSizeCallback: (YMKOfflineCacheManager) clearWithClearCallback: (YMKOfflineCacheManager) moveDataWithNewPath:dataMoveListener: (YMKOfflineCacheManager) drop (YMKOfflineCacheRegion) start (YMKOfflineCacheRegion)

Instance Methods

- addListenerWithManagerListener:

Subscribes a listener for "download status" events.

- addStorageErrorListenerWithErrorListener:

Subscribes the listener to storage error events.

- allowUseCellularNetworkWithUseCellular:

Indicates whether to allow downloading using cellular networks (3G, LTE, etc.) Disallowed by default.

- clearWithClearCallback:

Erases all data for downloads and regions and wipes the tile cache.

- computeCacheSizeWithSizeCallback:

Calculates the full cache size in bytes.

- enableAutoUpdateWithEnable:

Enables autoupdating downloaded caches when they become outdated.

- filterRegionsWithFilter:

Returns a filtered list of regions.

- moveDataWithNewPath:dataMoveListener:

Moves offline caches to the specified folder.

- regions

Returns a list of regions.

- removeListenerWithManagerListener:

Unsubscribes the listener from manager events.

- removeStorageErrorListenerWithErrorListener:

Unsubscribes the error listener from storage error events.

- requestPathWithPathGetterListener:

Provides the data path for offline cache files.

- setCachePathWithPath:

Sets a new path for caches.

Properties

valid

Tells if this object is valid or no.

Method Detail

-addListenerWithManagerListener:

- (void)addListenerWithManagerListener:(nonnull id< YMKOfflineCacheManagerListener >)managerListener 

Subscribes a listener for "download status" events.

The listener will receive the onListUpdated callback asynchronously after the call.
Parameters:
managerListener

Listener that will receive the events.

-addStorageErrorListenerWithErrorListener:

- (void)addStorageErrorListenerWithErrorListener:(nonnull id< YMKStorageErrorListener >)errorListener 

Subscribes the listener to storage error events.

Parameters:
errorListener

Listener that will receive storage error events.

-allowUseCellularNetworkWithUseCellular:

- (void)allowUseCellularNetworkWithUseCellular:(BOOL)useCellular 

Indicates whether to allow downloading using cellular networks (3G, LTE, etc.) Disallowed by default.

-clearWithClearCallback:

- (void)clearWithClearCallback:(nonnull YMKOfflineCacheManagerClearCallback)clearCallback 

Erases all data for downloads and regions and wipes the tile cache.

Forces reloading the list from the remote source.

-computeCacheSizeWithSizeCallback:

- (void)computeCacheSizeWithSizeCallback:(nonnull YMKOfflineCacheManagerSizeCallback)sizeCallback 

Calculates the full cache size in bytes.

-enableAutoUpdateWithEnable:

- (void)enableAutoUpdateWithEnable:(BOOL)enable 

Enables autoupdating downloaded caches when they become outdated.

-filterRegionsWithFilter:

- (nonnull NSArray< YMKOfflineCacheRegion * > *)filterRegionsWithFilter:(nonnull NSString *)filter 

Returns a filtered list of regions.

The filtered list is a subset of the full list of regions. Note that if the full list of regions is not ready yet, then the returned list of filtered regions will be empty. The list will also be empty if there aren't any regions that match the 'filter' expression.

-moveDataWithNewPath:dataMoveListener:

- (void)moveDataWithNewPath:(nonnull NSString *)newPath
           dataMoveListener:(nonnull id< YMKOfflineCacheDataMoveListener >)dataMoveListener 

Moves offline caches to the specified folder.

This operation is non-cancellable. If there is already a pending operation to set the cache path, it throws an error (Android). If the application exits before the operation is completed, it does not take effect, but garbage will not be cleared.
Parameters:
newPath

New path to store data.

dataMoveListener

It will be unsubscribed automatically when the operation is completed or fails with an error.

-regions

- (nonnull NSArray< YMKOfflineCacheRegion * > *)regions

Returns a list of regions.

An empty list indicates that the list is still loading. When it is ready, onListUpdated event will be called with the added/removed regions.

-removeListenerWithManagerListener:

- (void)removeListenerWithManagerListener:(nonnull id< YMKOfflineCacheManagerListener >)managerListener 

Unsubscribes the listener from manager events.

Does nothing if the listener was not subscribed.
Parameters:
managerListener

Listener to unsubscribe.

-removeStorageErrorListenerWithErrorListener:

- (void)removeStorageErrorListenerWithErrorListener:(nonnull id< YMKStorageErrorListener >)errorListener 

Unsubscribes the error listener from storage error events.

Does nothing if the error listener was not subscribed.
Parameters:
errorListener

Listener to unsubscribe.

-requestPathWithPathGetterListener:

- (void)requestPathWithPathGetterListener:(nonnull YMKOfflineCacheManagerPathGetterListener)pathGetterListener 

Provides the data path for offline cache files.

-setCachePathWithPath:

- (void)setCachePathWithPath:(nonnull NSString *)path 

Sets a new path for caches.

If the specified path contains an existing cache, this cache will be used; otherwise, a new cache will be initialized. This takes effect after the application is restarted.

Property Detail

valid

(assign, readonly, getter=isValid) BOOL valid

Tells if this object is valid or no.

Any method called on an invalid object will throw an exception. The object becomes invalid only on UI thread, and only when its implementation depends on objects already destroyed by now. Please refer to general docs about the interface for details on its invalidation.