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

URLSession:task:willBeginDelayedRequest:completionHandler:

Tells the delegate that a delayed URL session task will now begin loading. ある延期されたURLセッションタスクが今ロードを開始することを委任先に伝えます。

Declaration 宣言

- (void)URLSession:(NSURLSession *)session 
              task:(NSURLSessionTask *)task 
willBeginDelayedRequest:(NSURLRequest *)request 
 completionHandler:(void (^)(NSURLSessionDelayedRequestDisposition disposition, NSURLRequest *newRequest))completionHandler;

Parameters パラメータ

session

The session containing the delayed request. 延期されたリクエストを含んでいるセッション。

task

The task handling the delayed request. 延期されたリクエストを取り扱っているセッション。

request

The request that was delayed. 延期されたリクエスト。

completionHandler

A completion handler to perform the request. The completion handler takes two parameters: a disposition that tells the task how to proceed, and a new request object that is only used if the disposition is NSURLSessionDelayedRequestUseNewRequest. リクエストを実行する完了ハンドラ。完了ハンドラは、2つのパラメータを取ります:ある意向、それはタスクにどのように続行するか伝えます、そして新しいリクエストオブジェクト、それは意向がNSURLSessionDelayedRequestUseNewRequestであるならぱ使われるだけです。

Discussion 議論

This method is called when a background session task with a delayed start time (as set with the earliestBeginDate property) is ready to start. This delegate method should only be implemented if the request might become stale while waiting for the network load and needs to be replaced by a new request. このメソッドは、ある延期された開始時間(earliestBeginDateプロパティで設定されるように)でのバックグラウンドセッションタスクが開始する準備ができる時に呼び出されます。この委任先メソッドは、リクエストがネットワークロードを待っている間に新鮮でなくなるかもしれないそして新しいリクエストによって置き換えられる必要があるならば実装されるだけであるべきです。

For loading to continue, the delegate must call the completion handler, passing in a disposition that indicates how the task should proceed. Passing the NSURLSessionDelayedRequestCancel disposition is equivalent to calling cancel on the task directly. ロードを継続するために、委任先は完了ハンドラを呼び出さなければなりません、ある意向を渡して、それはどのようにタスクが続けるべきかを指し示します。NSURLSessionDelayedRequestCancelの意向を渡すことは、cancelをタスク上で直接に呼び出す事と等しいです。

See Also 参照

Handling Delayed and Waiting Tasks 遅延されたそして待機しているタスクを取り扱う