NSURLConnectionDelegate的connection:didReceiveResponse:方法

connection:didReceiveResponse:

Sent when the connection has received sufficient data to construct the URL response for its request.

- (void)connection:( NSURLConnection *) connection didReceiveResponse:( NSURLResponse *) response
Parameters
connection

The connection sending the message.

response

The URL response for the connection's request. This object is immutable and will not be modified by the URL loading system once it is presented to the delegate.

Discussion

In rare cases, for example in the case of an HTTP load where the content type of the load data is multipart/x-mixed-replace, the delegate will receive more than one connection:didReceiveResponse: message. In the event this occurs, delegates should discard all data previously delivered by connection:didReceiveData:, and should be prepared to handle the, potentially different, MIME type reported by the newly reported URL response.

The only case where this message is not sent to the delegate is when the protocol implementation encounters an error before a response could be created.

你可能感兴趣的:(object,url,System,immutable,delegates)