Contents

ensureLocalAvailabilityOfAssetPack:requireLatestVersion:completionHandler:

Ensures that the specified asset pack be available locally.

Declaration

- (void) ensureLocalAvailabilityOfAssetPack:(BAAssetPack *) assetPack requireLatestVersion:(BOOL) shouldUpdate completionHandler:(void (^)(NSError *error)) completionHandler;

Parameters

  • assetPack:

    The asset pack the local availability of which to ensure.

  • shouldUpdate:

    Whether to require that the latest version be available locally. When YES is passed to this parameter, the method will wait for the update (if there indeed is one available) to be downloaded before returning. When NO is passed, the method won’t check for updates and won’t attempt to download any.

  • completionHandler:

    A block that’s called when the asset pack is available locally or that receives an error if one occurs.

Discussion

This method checks if the asset pack is currently downloaded. If it isn’t, then it schedules it to be downloaded and calls the block with nil for the block’s error parameter when the download completes. It’s guaranteed that the requested asset pack will be available locally once the block is called with nil for its error parameter. If a non-nil value is provided to the block’s error parameter, then the asset pack is not guaranteed to be available locally. You can optionally monitor download progress by attaching a delegate object to delegate.