connection:didReceiveResponse:
Sent when the connection has received sufficient data to construct the URL response for its request.
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.

本文详细解释了当NSURLConnection接收到足够数据构建请求URL响应时触发的didReceiveResponse:回调的作用、参数及处理流程。在HTTP加载场景中,可能会接收到多个此消息,此时应清除先前接收的数据并准备处理新报告的MIME类型。
1万+

被折叠的 条评论
为什么被折叠?



