Instance Method


Creates a URL protocol instance to handle the task.


- (instancetype)initWithTask:(NSURLSessionTask *)task cachedResponse:(NSCachedURLResponse *)cachedResponse client:(id<NSURLProtocolClient>)client;



A task containing a URL request to be performed by the protocol.


A cached response for the task; may be nil if there is no existing cached response for the task.


An object that provides an implementation of the NSURLProtocolClient protocol that this instance uses to communicate with the URL loading system. This client object is retained.

Return Value

The initialized protocol object.


Subclasses should override this method to do any custom initialization. Don’t call this method explicitly. When you register your custom protocol class, the system will initialize instances of your protocol as needed.

This initializer calls through to initWithRequest:cachedResponse:client:.

See Also

Creating Protocol Objects

- initWithRequest:cachedResponse:client:

Creates a URL protocol instance to handle the request.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software