MMKOfflineCacheManager
- Summary
- Instance methods
- regions
- allowUseCellularNetworkWithUseCellular:
- addRegionListUpdatesListenerWithRegionListUpdatesListener:
- removeRegionListUpdatesListenerWithRegionListUpdatesListener:
- addErrorListenerWithErrorListener:
- removeErrorListenerWithErrorListener:
- addRegionListenerWithRegionListener:
- removeRegionListenerWithRegionListener:
- getCitiesWithRegionId:
- getStateWithRegionId:
- getDownloadedReleaseTimeWithRegionId:
- getProgressWithRegionId:
- startDownloadWithRegionId:
- stopDownloadWithRegionId:
- pauseDownloadWithRegionId:
- dropWithRegionId:
- mayBeOutOfAvailableSpaceWithRegionId:
- isLegacyPathWithRegionId:
- computeCacheSizeWithSizeCallback:
- requestPathWithPathGetterListener:
- moveDataWithNewPath:dataMoveListener:
- setCachePathWithPath:pathSetterListener:
- enableAutoUpdateWithEnable:
- clearWithClearCallback:
- requestRegionsAtPointWithPoint:regionsAtPointCallback:
- Properties
@interface MMKOfflineCacheManager : NSObject |
Note
This feature is not available in the free MapKit version.
Offline cache manager.
Summary
Instance methods
- (nonnull NSArray<MMKOfflineCacheRegion *> *)regions; |
- (void)allowUseCellularNetworkWithUseCellular:(BOOL)useCellular; |
- (void)addRegionListUpdatesListenerWithRegionListUpdatesListener: The class does not retain the object in the 'regionListUpdatesListener' parameter |
- (void)removeRegionListUpdatesListenerWithRegionListUpdatesListener: |
- (void)addErrorListenerWithErrorListener: The class does not retain the object in the 'errorListener' parameter |
- (void)removeErrorListenerWithErrorListener: |
- (void)addRegionListenerWithRegionListener: The class does not retain the object in the 'regionListener' parameter |
- (void)removeRegionListenerWithRegionListener: |
- (nonnull NSArray<NSString *> *)getCitiesWithRegionId:(NSUInteger)regionId; |
- (MMKOfflineCacheRegionState)getStateWithRegionId:(NSUInteger)regionId; |
- (nullable NSDate *)getDownloadedReleaseTimeWithRegionId:(NSUInteger)regionId; |
- (float)getProgressWithRegionId:(NSUInteger)regionId; |
- (void)startDownloadWithRegionId:(NSUInteger)regionId; |
- (void)stopDownloadWithRegionId:(NSUInteger)regionId; |
- (void)pauseDownloadWithRegionId:(NSUInteger)regionId; |
- (void)dropWithRegionId:(NSUInteger)regionId; |
- (BOOL)mayBeOutOfAvailableSpaceWithRegionId:(NSUInteger)regionId; |
- (BOOL)isLegacyPathWithRegionId:(NSUInteger)regionId; |
- (void)computeCacheSizeWithSizeCallback: |
- (void)requestPathWithPathGetterListener: |
- (void)moveDataWithNewPath:(nonnull NSString *)newPath |
- (void)setCachePathWithPath:(nonnull NSString *)path |
- (void)enableAutoUpdateWithEnable:(BOOL)enable; |
- (void)clearWithClearCallback: |
- (void)requestRegionsAtPointWithPoint:(nonnull MMKPoint *)point |
Properties
@property (nonatomic, readonly, getter=isValid) BOOL valid; |
Instance methods
regions
- (nonnull NSArray<MMKOfflineCacheRegion *> *)regions; |
Copying a list of regions from memory. All changes of regions won't affected on on the collection.
allowUseCellularNetworkWithUseCellular:
- (void)allowUseCellularNetworkWithUseCellular:(BOOL)useCellular; |
Indicates whether to allow downloading using cellular networks (3G, LTE, and other). Disallowed by default.
addRegionListUpdatesListenerWithRegionListUpdatesListener:
- (void)addRegionListUpdatesListenerWithRegionListUpdatesListener: |
Subscribe on update of region list
The class does not retain the object in the 'regionListUpdatesListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.
removeRegionListUpdatesListenerWithRegionListUpdatesListener:
- (void)removeRegionListUpdatesListenerWithRegionListUpdatesListener: |
Unsubscribe from region list update
addErrorListenerWithErrorListener:
- (void)addErrorListenerWithErrorListener: |
Subscribe on errors
The class does not retain the object in the 'errorListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.
removeErrorListenerWithErrorListener:
- (void)removeErrorListenerWithErrorListener: |
Unsubscribe from errors
addRegionListenerWithRegionListener:
- (void)addRegionListenerWithRegionListener: |
Subscribe on status events
The class does not retain the object in the 'regionListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.
removeRegionListenerWithRegionListener:
- (void)removeRegionListenerWithRegionListener: |
Unsubscribe from status events
getCitiesWithRegionId:
- (nonnull NSArray<NSString *> *)getCitiesWithRegionId:(NSUInteger)regionId; |
Returns a list of cities.
getStateWithRegionId:
- (MMKOfflineCacheRegionState)getStateWithRegionId:(NSUInteger)regionId; |
Current region state
getDownloadedReleaseTimeWithRegionId:
- (nullable NSDate *)getDownloadedReleaseTimeWithRegionId:(NSUInteger)regionId; |
Release time of downloaded region files
getProgressWithRegionId:
- (float)getProgressWithRegionId:(NSUInteger)regionId; |
Current region progress [0,1]. For downloaded files returns 1; If we haven't start download yet, returns 0;
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
pauseDownloadWithRegionId:
- (void)pauseDownloadWithRegionId:(NSUInteger)regionId; |
Pause downloading of region
dropWithRegionId:
- (void)dropWithRegionId:(NSUInteger)regionId; |
Drop region data from the device. If data is being downloaded then downloading is cancelled.
mayBeOutOfAvailableSpaceWithRegionId:
- (BOOL)mayBeOutOfAvailableSpaceWithRegionId:(NSUInteger)regionId; |
Returns true if available disk space might not be enough for installation of the region data.
isLegacyPathWithRegionId:
- (BOOL)isLegacyPathWithRegionId:(NSUInteger)regionId; |
Returns true if region has files with legacy localized path. If region in downloading state result may be incorrect.
computeCacheSizeWithSizeCallback:
- (void)computeCacheSizeWithSizeCallback: |
Calculates the full cache size in bytes.
requestPathWithPathGetterListener:
- (void)requestPathWithPathGetterListener: |
Provides the data path for offline cache files.
moveDataWithNewPath:dataMoveListener:
- (void)moveDataWithNewPath:(nonnull NSString *)newPath |
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.
The class does not retain the object in the 'dataMoveListener' parameter. It is your responsibility to maintain a strong reference to the target object while it is attached to a class.
Parameters |
|
newPath |
New path to store data. |
dataMoveListener |
It will be unsubscribed automatically when the operation is completed or fails with an error. |
setCachePathWithPath:pathSetterListener:
- (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.
enableAutoUpdateWithEnable:
- (void)enableAutoUpdateWithEnable:(BOOL)enable; |
Enables autoupdating downloaded caches when they become outdated.
clearWithClearCallback:
- (void)clearWithClearCallback: |
Erases all data for downloads and regions and wipes the cache. Forces reloading the list from the remote source
requestRegionsAtPointWithPoint:regionsAtPointCallback:
- (void)requestRegionsAtPointWithPoint:(nonnull MMKPoint *)point |
Provides ids of regions containing specified point. Some of the returned regions may not be available in current regions list.
Properties
valid
@property (nonatomic, 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.