Protocol: NSURLProtocolClient

Overview

The NSURLProtocolClient protocol provides the interface used by NSURLProtocol subclasses to communicate with the URL loading system. An application should never have the need to implement this protocol.Sent to indicate to the URL loading system that a cached response is valid. (required)Sent to indicate to the URL loading system that an authentication challenge has been canceled. (required)Sent when the load request fails due to an error. (required)An NSURLProtocol subclass instance, protocol, sends this message to [protocol client] as it loads data. (required)Sent to indicate to the URL loading system that an authentication challenge has been received. (required)Sent to indicate to the URL loading system that the protocol implementation has created a response object for the request. (required)Sent to indicate to the URL loading system that the protocol implementation has been redirected. (required)Sent to indicate to the URL loading system that the protocol implementation has finished loading. (required)

Instance Method Summary (collapse)

Instance Method Details

- (Object) URLProtocol(protocol, cachedResponseIsValid:cachedResponse)

Sent to indicate to the URL loading system that a cached response is valid. (required)

Parameters:

  • protocol (NSURLProtocol)

    The URL protocol object sending the message.

  • cachedResponse (NSCachedURLResponse)

    The cached response whose validity is being communicated.

Returns:

- (Object) URLProtocol(protocol, didCancelAuthenticationChallenge:challenge)

Sent to indicate to the URL loading system that an authentication challenge has been canceled. (required)

Parameters:

Returns:

- (Object) URLProtocol(protocol, didFailWithError:error)

Sent when the load request fails due to an error. (required)

Parameters:

  • protocol (NSURLProtocol)

    The URL protocol object sending the message.

  • error (NSError)

    The error that caused the failure of the load request.

Returns:

- (Object) URLProtocol(protocol, didLoadData:data)

An NSURLProtocol subclass instance, protocol, sends this message to [protocol client] as it loads data. (required)

The data object must contain only new data loaded since the previous invocation of this method.

Returns:

- (Object) URLProtocol(protocol, didReceiveAuthenticationChallenge:challenge)

Sent to indicate to the URL loading system that an authentication challenge has been received. (required)

The protocol client guarantees that it will answer the request on the same thread that called this method. The client may add a default credential to the challenge it issues to the connection delegate, if protocol did not provide one.

Parameters:

Returns:

- (Object) URLProtocol(protocol, didReceiveResponse:response, cacheStoragePolicy:policy)

Sent to indicate to the URL loading system that the protocol implementation has created a response object for the request. (required) The implementation should use the provided cache storage policy to determine whether to store the response in a cache.

Parameters:

Returns:

- (Object) URLProtocol(protocol, wasRedirectedToRequest:request, redirectResponse:redirectResponse)

Sent to indicate to the URL loading system that the protocol implementation has been redirected. (required)

Parameters:

  • protocol (NSURLProtocol)

    The URL protocol object sending the message.

  • request (NSURLRequest)

    The new request that the original request was redirected to.

  • redirectResponse (NSURLResponse)

    The response from the original request that caused the redirect.

Returns:

- (Object) URLProtocolDidFinishLoading(protocol)

Sent to indicate to the URL loading system that the protocol implementation has finished loading. (required)

Parameters:

  • protocol (NSURLProtocol)

    The URL protocol object sending the message.

Returns: