pub unsafe trait BADownloaderExtension: NSObjectProtocol {
// Provided methods
unsafe fn downloadsForRequest_manifestURL_extensionInfo(
&self,
content_request: BAContentRequest,
manifest_url: &NSURL,
extension_info: &BAAppExtensionInfo,
) -> Retained<NSSet<BADownload>>
where Self: Sized + Message { ... }
unsafe fn backgroundDownload_didReceiveChallenge_completionHandler(
&self,
download: &BADownload,
challenge: &NSURLAuthenticationChallenge,
completion_handler: &DynBlock<dyn Fn(NSURLSessionAuthChallengeDisposition, *mut NSURLCredential)>,
)
where Self: Sized + Message { ... }
unsafe fn backgroundDownload_failedWithError(
&self,
download: &BADownload,
error: &NSError,
)
where Self: Sized + Message { ... }
unsafe fn backgroundDownload_finishedWithFileURL(
&self,
download: &BADownload,
file_url: &NSURL,
)
where Self: Sized + Message { ... }
unsafe fn extensionWillTerminate(&self)
where Self: Sized + Message { ... }
}BADownloaderExtension only.Expand description
Provided Methods§
Sourceunsafe fn downloadsForRequest_manifestURL_extensionInfo(
&self,
content_request: BAContentRequest,
manifest_url: &NSURL,
extension_info: &BAAppExtensionInfo,
) -> Retained<NSSet<BADownload>>
Available on crate features BAAppExtensionInfo and BADownload and BATypes only.
unsafe fn downloadsForRequest_manifestURL_extensionInfo( &self, content_request: BAContentRequest, manifest_url: &NSURL, extension_info: &BAAppExtensionInfo, ) -> Retained<NSSet<BADownload>>
BAAppExtensionInfo and BADownload and BATypes only.Invoked by the system when the extension should check for updated content.
This method will be invoked by the system upon requested events defined in BAContentRequest.
This method should return a set of all BAURLDownload’s that your extension would like to schedule.
During the invocation of this method, BADownloadManager will prohibit the ability to schedule additional downloads
until this method exits scope. Therefore, all downloads needing to be scheduled should be returned here.
If a download fails, it can be rescheduled using BADownloadManager in any other method in this protocol.
Parameter contentRequest: The content request event that occurred that caused this method to be invoked.
Parameter manifestURL: A file URL to the local manifest that was pre-downloaded and specified in your App’s Info.plist under the BAManifestURL.
The file is read-only and will be deleted after this method returns. If you wish to keep it, you must copy it out.
Parameter extensionInfo: Information about your extension that may be useful for making a decision about
what content needs to be scheduled.
Returns: A set of unique BAURLDownload objects that the extension should schedule for download.
Warning: You cannot use BADownloadManager to manually schedule downloads using this method. All downloads to enqueue must be returned.
Sourceunsafe fn backgroundDownload_didReceiveChallenge_completionHandler(
&self,
download: &BADownload,
challenge: &NSURLAuthenticationChallenge,
completion_handler: &DynBlock<dyn Fn(NSURLSessionAuthChallengeDisposition, *mut NSURLCredential)>,
)
Available on crate features BADownload and block2 only.
unsafe fn backgroundDownload_didReceiveChallenge_completionHandler( &self, download: &BADownload, challenge: &NSURLAuthenticationChallenge, completion_handler: &DynBlock<dyn Fn(NSURLSessionAuthChallengeDisposition, *mut NSURLCredential)>, )
BADownload and block2 only.Download is about to begin but requires an authentication challenge to continue.
§Safety
completion_handler block must be sendable.
Sourceunsafe fn backgroundDownload_failedWithError(
&self,
download: &BADownload,
error: &NSError,
)
Available on crate feature BADownload only.
unsafe fn backgroundDownload_failedWithError( &self, download: &BADownload, error: &NSError, )
BADownload only.This method is called when a download has failed but there is no BADownloadManager delegate to handle the completion event.
When a download has failed, this method will be invoked.
If a download fails you may reschedule it with BADownloadManager.
Parameter download: The download object that has failed.
Parameter error: The error that caused the failure.
Sourceunsafe fn backgroundDownload_finishedWithFileURL(
&self,
download: &BADownload,
file_url: &NSURL,
)
Available on crate feature BADownload only.
unsafe fn backgroundDownload_finishedWithFileURL( &self, download: &BADownload, file_url: &NSURL, )
BADownload only.This method is called when a download has finished but there is no BADownloadManager delegate to handle the completion event.
Parameter download: Download that has completed successfully.
Parameter fileURL: A location to the file that has been downloaded.
When a download succeeds, this method will be invoked; however it is only invoked if there is no other client using BADownloadManager
with a hooked in delegate. The file located at fileURL must be moved before this method exits scope, or it will be deleted.
It is strongly advised to move the file to its permanent destination rather than copy it.
Warning: The file is marked by the system for deletion when the device becomes low on storage. Avoid copying or modifying the file, as this may remove the system’s ability to delete the file.
Sourceunsafe fn extensionWillTerminate(&self)
👎Deprecated: extensionWillTerminate will not be invoked in all applicable circumstances and should not be relied upon.
unsafe fn extensionWillTerminate(&self)
This method may be called shortly before the extension is terminated.
This method is invoked if all extension callbacks have returned or if the extension has run over its allotted runtime. This callback provides a last chance to tidy up state before process termination.
Warning: This method is advisory only, there will be instances where the extension is terminated before this method is invoked. Do not rely on this method being invoked before the extension is terminated.