YMKOfflineCacheManager
- Summary
- Instance methods
- regions()
- allowUseCellularNetwork(withUseCellular:)
- addRegionListUpdatesListener(with:)
- removeRegionListUpdatesListener(with:)
- addErrorListenerWith(_:)
- removeErrorListenerWith(_:)
- addRegionListener(with:)
- removeRegionListener(with:)
- getCitiesWithRegionId(_:)
- getStateWithRegionId(_:)
- getDownloadedReleaseTime(withRegionId:)
- getProgressWithRegionId(_:)
- startDownload(withRegionId:)
- stopDownload(withRegionId:)
- pauseDownload(withRegionId:)
- drop(withRegionId:)
- mayBeOutOfAvailableSpace(withRegionId:)
- isLegacyPath(withRegionId:)
- computeCacheSize(sizeCallback:)
- requestPath(pathGetterListener:)
- moveData(withNewPath:dataMoveListener:)
- setCachePathWithPath(_:pathSetterListener:)
- enableAutoUpdate(withEnable:)
- clear(clearCallback:)
- requestRegionsAtPoint(with:regionsAtPointCallback:)
- Properties
class YMKOfflineCacheManager : NSObject |
Примечание
This feature is not available in the free MapKit version.
Offline cache manager.
Summary
Instance methods
func regions() -> [YMKOfflineCacheRegion] |
func allowUseCellularNetwork(withUseCellular useCellular: Bool) |
func addRegionListUpdatesListener(with regionListUpdatesListener: YMKOfflineMapRegionListUpdatesListener) The class does not retain the object in the 'regionListUpdatesListener' parameter |
func removeRegionListUpdatesListener(with regionListUpdatesListener: YMKOfflineMapRegionListUpdatesListener) |
func addErrorListenerWith( errorListener: YMKOfflineCacheManagerErrorListener_) The class does not retain the object in the 'errorListener' parameter |
func removeErrorListenerWith( errorListener: YMKOfflineCacheManagerErrorListener_) |
func addRegionListener(with regionListener: YMKOfflineCacheRegionListener) The class does not retain the object in the 'regionListener' parameter |
func removeRegionListener(with regionListener: YMKOfflineCacheRegionListener) |
func getCitiesWithRegionId(_ regionId: UInt) -> [String] |
func getStateWithRegionId( regionId: UInt) -> YMKOfflineCacheRegionState_ |
func getDownloadedReleaseTime(withRegionId regionId: UInt) -> Date? |
func getProgressWithRegionId(_ regionId: UInt) -> Float |
func startDownload(withRegionId regionId: UInt) |
func stopDownload(withRegionId regionId: UInt) |
func pauseDownload(withRegionId regionId: UInt) |
func drop(withRegionId regionId: UInt) |
func mayBeOutOfAvailableSpace(withRegionId regionId: UInt) -> Bool |
func isLegacyPath(withRegionId regionId: UInt) -> Bool |
func computeCacheSize(sizeCallback: @escaping YMKOfflineCacheManagerSizeCallback) |
func requestPath(pathGetterListener: @escaping YMKOfflineCacheManagerPathGetterListener) |
func moveData(withNewPath newPath: String, |
func setCachePathWithPath(_ path: String, |
func enableAutoUpdate(withEnable enable: Bool) |
func clear(clearCallback: @escaping YMKOfflineCacheManagerClearCallback) |
func requestRegionsAtPoint(with point: YMKPoint, |
Properties
var isValid: Bool { get } |
Instance methods
regions()
func regions() -> [YMKOfflineCacheRegion] |
Copying a list of regions from memory. All changes of regions won't affected on on the collection.
allowUseCellularNetwork(withUseCellular:)
func allowUseCellularNetwork(withUseCellular useCellular: Bool) |
Indicates whether to allow downloading using cellular networks (3G, LTE, and other). Disallowed by default.
addRegionListUpdatesListener(with:)
func addRegionListUpdatesListener(with regionListUpdatesListener: YMKOfflineMapRegionListUpdatesListener) |
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.
removeRegionListUpdatesListener(with:)
func removeRegionListUpdatesListener(with regionListUpdatesListener: YMKOfflineMapRegionListUpdatesListener) |
Unsubscribe from region list update
addErrorListenerWith(_:)
func addErrorListenerWith( errorListener: YMKOfflineCacheManagerErrorListener_) |
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.
removeErrorListenerWith(_:)
func removeErrorListenerWith( errorListener: YMKOfflineCacheManagerErrorListener_) |
Unsubscribe from errors
addRegionListener(with:)
func addRegionListener(with regionListener: YMKOfflineCacheRegionListener) |
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.
removeRegionListener(with:)
func removeRegionListener(with regionListener: YMKOfflineCacheRegionListener) |
Unsubscribe from status events
getCitiesWithRegionId(_:)
func getCitiesWithRegionId(_ regionId: UInt) -> [String] |
Returns a list of cities.
getStateWithRegionId(_:)
func getStateWithRegionId( regionId: UInt) -> YMKOfflineCacheRegionState_ |
Current region state
getDownloadedReleaseTime(withRegionId:)
func getDownloadedReleaseTime(withRegionId regionId: UInt) -> Date? |
Release time of downloaded region files
getProgressWithRegionId(_:)
func getProgressWithRegionId(_ regionId: UInt) -> Float |
Current region progress [0,1]. For downloaded files returns 1; If we haven't start download yet, returns 0;
startDownload(withRegionId:)
func startDownload(withRegionId regionId: UInt) |
Start to download new offline cache for the region or update if region has been downloaded
stopDownload(withRegionId:)
func stopDownload(withRegionId regionId: UInt) |
Stop downloading of region
pauseDownload(withRegionId:)
func pauseDownload(withRegionId regionId: UInt) |
Pause downloading of region
drop(withRegionId:)
func drop(withRegionId regionId: UInt) |
Drop region data from the device. If data is being downloaded then downloading is cancelled.
mayBeOutOfAvailableSpace(withRegionId:)
func mayBeOutOfAvailableSpace(withRegionId regionId: UInt) -> Bool |
Returns true if available disk space might not be enough for installation of the region data.
isLegacyPath(withRegionId:)
func isLegacyPath(withRegionId regionId: UInt) -> Bool |
Returns true if region has files with legacy localized path. If region in downloading state result may be incorrect.
computeCacheSize(sizeCallback:)
func computeCacheSize(sizeCallback: @escaping YMKOfflineCacheManagerSizeCallback) |
Calculates the full cache size in bytes.
requestPath(pathGetterListener:)
func requestPath(pathGetterListener: @escaping YMKOfflineCacheManagerPathGetterListener) |
Provides the data path for offline cache files.
moveData(withNewPath:dataMoveListener:)
func moveData(withNewPath newPath: String, |
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:)
func setCachePathWithPath(_ path: String, |
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.
enableAutoUpdate(withEnable:)
func enableAutoUpdate(withEnable enable: Bool) |
Enables autoupdating downloaded caches when they become outdated.
clear(clearCallback:)
func clear(clearCallback: @escaping YMKOfflineCacheManagerClearCallback) |
Erases all data for downloads and regions and wipes the cache. Forces reloading the list from the remote source
requestRegionsAtPoint(with:regionsAtPointCallback:)
func requestRegionsAtPoint(with point: YMKPoint, |
Provides ids of regions containing specified point. Some of the returned regions may not be available in current regions list.
Properties
isValid
var isValid: Bool { get } |
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.