Force Item Download in File Provider

I've file provider implementation where, in some cases, we must force download items, so they get materialized in local cache.

I've used requestdownloadforitem based on following documentation https://developer.apple.com/documentation/fileprovider/nsfileprovidermanager/requestdownloadforitem(withidentifier:requestedrange:)

I'm calling this within Extension code, but this does not trigger the download.

How can I force file provider to download a file?

cheers,

Answered by Engineer in 801760022

requestDownload enqueues the item for downloading at a later time, dependent on device conditions.

You can declaratively configure the download policy for an item using -[NSFileProviderItem contentPolicy] (https://developer.apple.com/documentation/fileprovider/nsfileprovideritemprotocol/contentpolicy?language=objc). Use the .downloadEagerlyAndKeepDownloaded option to ensure that the item is kept downloaded on the device.

requestDownload enqueues the item for downloading at a later time, dependent on device conditions.

You can declaratively configure the download policy for an item using -[NSFileProviderItem contentPolicy] (https://developer.apple.com/documentation/fileprovider/nsfileprovideritemprotocol/contentpolicy?language=objc). Use the .downloadEagerlyAndKeepDownloaded option to ensure that the item is kept downloaded on the device.

Force Item Download in File Provider
 
 
Q