Instance Method インスタンスメソッド

connection(_:didReceive:)

Sent when the connection has received sufficient data to construct the URL response for its request. 接続がそれのリクエストに対するURL応答を組み立てるのに十分なデータを受け取った場合に送られます。

Declaration 宣言

optional func connection(_ connection: NSURLConnection, 
              didReceive response: URLResponse)

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. 接続の持つリクエストに対するURL応答。このオブジェクトは不変です、そしてURLローディングシステムによって変更されません、一旦それが委任先に提出されるならば。

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. When this happens, discard (or process) all data previously delivered by connection:didReceiveData:, and prepare to handle the next part (which could potentially have a different MIME type). まれに、例えばロードデータのコンテンツ型がmultipart/x-mixed-replaceであるHTTPロードの場合において、委任先は1つ以上のconnection:didReceiveResponse:メッセージを受け取るかもしれません。これが起こる場合、connection:didReceiveData:によって以前に配達された全てのデータを廃棄(または処理)してください、そして次の部分(それは潜在的に異なるMIMEタイプを持つ可能性があります)を取り扱うために準備してください。

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. このメッセージが委任先に送られない唯一の事例は、応答が作成されないうちにプロトコル実装がエラーに出くわす場合です。

See Also 参照

Handling Incoming Data やってくるデータを取り扱う

Related Documentation 関連文書