ensureLocalAvailabilityOfAssetPacks:requireLatestVersions:completionHandler:
Ensures that the specified asset packs are available locally, performing a batch download if necessary.
Declaration
- (void) ensureLocalAvailabilityOfAssetPacks:(NSSet<BAAssetPack *> *) assetPacks requireLatestVersions:(BOOL) shouldUpdate completionHandler:(void (^)(NSError *error)) completionHandler;Parameters
- assetPacks:
The asset packs the local availability of which to ensure.
- shouldUpdate:
Whether to require that the respective latest versions be available locally. When
YESis passed to this parameter, the method will wait for the updates (if there indeed are any available) to be downloaded before returning. WhenNOis passed, the method won’t check for updates and won’t attempt to download any. - completionHandler:
A block that’s called when the asset packs are all available locally or that receives an error if one occurs.
Mentioned in
Discussion
This method checks whether the asset packs are currently downloaded. If any aren’t, then the system schedules them for download and calls the completion handler with nil for the completion handler’s error parameter after all of the downloads finish. The framework guarantees that the requested asset packs are available locally after this method calls the completion handler with nil for the error parameter. If this method calls the completion handler with a non-nil value for error, then the asset packs aren’t all guaranteed to be available locally. You can optionally monitor download progress by attaching a delegate object to delegate.
See Also
Managing asset packs
checkForUpdatesWithCompletionHandler:ensureLocalAvailabilityOfAssetPack:completionHandler:ensureLocalAvailabilityOfAssetPacks:completionHandler:ensureLocalAvailabilityOfAssetPack:requireLatestVersion:completionHandler:assetPackIsAvailableLocallyWithIdentifier:getStatusRelativeToAssetPack:completionHandler:getLocalStatusOfAssetPackWithIdentifier:completionHandler:removeAssetPackWithIdentifier:completionHandler:getStatusOfAssetPackWithIdentifier:completionHandler: