Trait WKURLSchemeTask

Source
pub unsafe trait WKURLSchemeTask: NSObjectProtocol {
    // Provided methods
    unsafe fn request(&self) -> Retained<NSURLRequest>
       where Self: Sized + Message { ... }
    unsafe fn didReceiveResponse(&self, response: &NSURLResponse)
       where Self: Sized + Message { ... }
    unsafe fn didReceiveData(&self, data: &NSData)
       where Self: Sized + Message { ... }
    unsafe fn didFinish(&self)
       where Self: Sized + Message { ... }
    unsafe fn didFailWithError(&self, error: &NSError)
       where Self: Sized + Message { ... }
}
Available on crate feature WKURLSchemeTask only.
Expand description

Provided Methods§

Source

unsafe fn request(&self) -> Retained<NSURLRequest>
where Self: Sized + Message,

The request to load for this task.

Source

unsafe fn didReceiveResponse(&self, response: &NSURLResponse)
where Self: Sized + Message,

Set the current response object for the task.

Parameter response: The response to use.

This method must be called at least once for each URL scheme handler task. Cross-origin requests require CORS header fields. An exception will be thrown if you try to send a new response object after the task has already been completed. An exception will be thrown if your app has been told to stop loading this task via the registered WKURLSchemeHandler object.

Source

unsafe fn didReceiveData(&self, data: &NSData)
where Self: Sized + Message,

Add received data to the task.

Parameter data: The data to add.

After a URL scheme handler task’s final response object is received you should start sending it data. Each time this method is called the data you send will be appended to all previous data. An exception will be thrown if you try to send the task any data before sending it a response. An exception will be thrown if you try to send the task any data after the task has already been completed. An exception will be thrown if your app has been told to stop loading this task via the registered WKURLSchemeHandler object.

Source

unsafe fn didFinish(&self)
where Self: Sized + Message,

Mark the task as successfully completed.

An exception will be thrown if you try to finish the task before sending it a response. An exception will be thrown if you try to mark a task completed after it has already been marked completed or failed. An exception will be thrown if your app has been told to stop loading this task via the registered WKURLSchemeHandler object.

Source

unsafe fn didFailWithError(&self, error: &NSError)
where Self: Sized + Message,

Mark the task as failed.

Parameter error: A description of the error that caused the task to fail.

An exception will be thrown if you try to mark a task failed after it has already been marked completed or failed. An exception will be thrown if your app has been told to stop loading this task via the registered WKURLSchemeHandler object.

Trait Implementations§

Source§

impl ProtocolType for dyn WKURLSchemeTask

Source§

const NAME: &'static str = "WKURLSchemeTask"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn WKURLSchemeTask

Implementations on Foreign Types§

Source§

impl<T> WKURLSchemeTask for ProtocolObject<T>
where T: ?Sized + WKURLSchemeTask,

Implementors§