Class YMKOfflineCacheManager

Attention.

This feature is not available in the free MapKit version.

Offline cache manager.

Instance Methods

- addErrorListenerWithErrorListener:

Subscribe on errors.

- addRegionListenerWithRegionListener:

Subscribe on status events.

- addRegionListUpdatesListenerWithRegionListUpdatesListener:

Subscribe on update of region list.

- 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.

- dropWithRegionId:

Drop region data from the device.

- enableAutoUpdateWithEnable:

Enables autoupdating downloaded caches when they become outdated.

- getCitiesWithRegionId:

Returns a list of cities.

- getProgressWithRegionId:

Current region progress [0,1].

- getStateWithRegionId:

Current region state.

- isLegacyPathWithRegionId:

Returns true if region has files with legacy localized path.

- mayBeOutOfAvailableSpaceWithRegionId:

Returns true if available disk space might not be enough for installation of the region data.

- moveDataWithNewPath:dataMoveListener:

Moves offline caches to the specified folder.

- pauseDownloadWithRegionId:

Pause downloading of region.

- regions

Copying a list of regions from memory.

- removeErrorListenerWithErrorListener:

Unsubscribe from errors.

- removeRegionListenerWithRegionListener:

Unsubscribe from status events.

- removeRegionListUpdatesListenerWithRegionListUpdatesListener:

Unsubscribe from region list update.

- requestPathWithPathGetterListener:

Provides the data path for offline cache files.

- setCachePathWithPath:

Sets a new path for caches.

- startDownloadWithRegionId:

Start to download new offline cache for the region or update if region has been downloaded.

- stopDownloadWithRegionId:

Stop downloading of region.

Properties

valid

Tells if this object is valid or no.

Method Detail

-addErrorListenerWithErrorListener:

- (void)addErrorListenerWithErrorListener:(nonnull id< YMKOfflineCacheManagerErrorListener >)errorListener 

Subscribe on errors.

-addRegionListUpdatesListenerWithRegionListUpdatesListener:

- (void)addRegionListUpdatesListenerWithRegionListUpdatesListener:(nonnull id< YMKOfflineMapRegionListUpdatesListener >)regionListUpdatesListener 

Subscribe on update of region list.

-addRegionListenerWithRegionListener:

- (void)addRegionListenerWithRegionListener:(nonnull id< YMKOfflineCacheRegionListener >)regionListener 

Subscribe on status 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.

-dropWithRegionId:

- (void)dropWithRegionId:(NSUInteger)regionId 

Drop region data from the device.

If data is being downloaded then downloading is cancelled.

-enableAutoUpdateWithEnable:

- (void)enableAutoUpdateWithEnable:(BOOL)enable 

Enables autoupdating downloaded caches when they become outdated.

-getCitiesWithRegionId:

- (nonnull NSArray< NSString * > *)getCitiesWithRegionId:(NSUInteger)regionId 

Returns a list of cities.

-getProgressWithRegionId:

- (float)getProgressWithRegionId:(NSUInteger)regionId 

Current region progress [0,1].

For downloaded files returns 1; If we haven't start download yet, returns 0;

-getStateWithRegionId:

- (YMKOfflineCacheRegionState)getStateWithRegionId:(NSUInteger)regionId 

Current region state.

-isLegacyPathWithRegionId:

- (BOOL)isLegacyPathWithRegionId:(NSUInteger)regionId 

Returns true if region has files with legacy localized path.

If region in downloading state result may be incorrect.

-mayBeOutOfAvailableSpaceWithRegionId:

- (BOOL)mayBeOutOfAvailableSpaceWithRegionId:(NSUInteger)regionId 

Returns true if available disk space might not be enough for installation of the region data.

-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.

-pauseDownloadWithRegionId:

- (void)pauseDownloadWithRegionId:(NSUInteger)regionId 

Pause downloading of region.

-regions

- (nonnull NSArray< YMKOfflineCacheRegion * > *)regions

Copying a list of regions from memory.

All changes of regions won't affected on on the collection.

-removeErrorListenerWithErrorListener:

- (void)removeErrorListenerWithErrorListener:(nonnull id< YMKOfflineCacheManagerErrorListener >)errorListener 

Unsubscribe from errors.

-removeRegionListUpdatesListenerWithRegionListUpdatesListener:

- (void)removeRegionListUpdatesListenerWithRegionListUpdatesListener:(nonnull id< YMKOfflineMapRegionListUpdatesListener >)regionListUpdatesListener 

Unsubscribe from region list update.

-removeRegionListenerWithRegionListener:

- (void)removeRegionListenerWithRegionListener:(nonnull id< YMKOfflineCacheRegionListener >)regionListener 

Unsubscribe from status events.

-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.

-startDownloadWithRegionId:

- (void)startDownloadWithRegionId:(NSUInteger)regionId 

Start to download new offline cache for the region or update if region has been downloaded.

-stopDownloadWithRegionId:

- (void)stopDownloadWithRegionId:(NSUInteger)regionId 

Stop downloading of region.

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.