VBDOfflinePack
@interface VBDOfflinePack : NSObject
An VBDOfflinePack represents a collection of resources necessary for viewing
a region offline to a local database.
To create an instance of VBDOfflinePack, use the
+[VBDOfflineStorage addPackForRegion:withContext:completionHandler:] method.
A pack created using -[VBDOfflinePack init] is immediately invalid.
-
The region for which the pack manages resources.
Declaration
Objective-C
@property (readonly, nonatomic) id<VBDOfflineRegion> _Nonnull region; -
Arbitrary data stored alongside the downloaded resources.
The context typically holds application-specific information for identifying the pack, such as a user-selected name.
Declaration
Objective-C
@property (readonly, nonatomic) NSData *_Nonnull context; -
The pack’s current state.
The state of an inactive or completed pack is computed lazily and is set to
VBDOfflinePackStateUnknownby default. To request the pack’s status, use the-requestProgressmethod. To get notified when the state becomes known and when it changes, observe KVO change notifications on this pack’sstatekey path. Alternatively, you can add an observer forVBDOfflinePackProgressChangedNotifications about this pack that come from the default notification center.Declaration
Objective-C
@property (readonly, nonatomic) VBDOfflinePackState state; -
The pack’s current progress.
The progress of an inactive or completed pack is computed lazily, and all its fields are set to 0 by default. To request the pack’s progress, use the
-requestProgressmethod. To get notified when the progress becomes known and when it changes, observe KVO change notifications on this pack’sstatekey path. Alternatively, you can add an observer forVBDOfflinePackProgressChangedNotifications about this pack that come from the default notification center.Declaration
Objective-C
@property (readonly, nonatomic) VBDOfflinePackProgress progress; -
Resumes downloading if the pack is inactive.
A pack resumes asynchronously. To get notified when this pack resumes, observe KVO change notifications on this pack’s
statekey path. Alternatively, you can add an observer forVBDOfflinePackProgressChangedNotifications about this pack that come from the default notification center.When a pack resumes after being suspended, it may begin by iterating over the already downloaded resources. As a result, the
progressstructure’scountOfResourcesCompletedfield may revert to 0 before rapidly returning to the level of progress at the time the pack was suspended.To temporarily suspend downloading, call the
-suspendmethod.Declaration
Objective-C
- (void)resume; -
Temporarily stops downloading if the pack is active.
A pack suspends asynchronously. To get notified when this pack resumes, observe KVO change notifications on this pack’s
statekey path. Alternatively, you can add an observer forVBDOfflinePackProgressChangedNotificationabout this pack that come from the default notification center.If the pack previously reached a higher level of progress before being suspended, it may wait to suspend until it returns to that level.
To resume downloading, call the
-resumemethod.Declaration
Objective-C
- (void)suspend; -
Request an asynchronous update to the pack’s
stateandprogressproperties.The state and progress of an inactive or completed pack are computed lazily. If you need the state or progress of a pack whose
stateproperty is currently set toVBDOfflinePackStateUnknown, observe KVO change notifications on this pack’sstatekey path, then call this method. Alternatively, you can add an observer forVBDOfflinePackProgressChangedNotificationabout this pack that come from the default notification center.Declaration
Objective-C
- (void)requestProgress;
VBDOfflinePack Class Reference