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

urlSession(_:taskIsWaitingForConnectivity:)

Tells the delegate that the task is waiting until suitable connectivity is available before beginning the network load. タスクがネットワークロードを開始する前にふさわしい接続性が利用可能になるまで待機していることを委任先に伝えます。

Declaration 宣言

optional func urlSession(_ session: URLSession, 
taskIsWaitingForConnectivity task: URLSessionTask)

Parameters パラメータ

session

The session that contains the waiting task. 待機しているタスクを含んでいるセッション。

task

The task that is waiting for a change in connectivity. 接続性における変化に対して待機しているタスク。

Discussion 議論

This method is called if the waitsForConnectivity property of URLSessionConfiguration is true, and sufficient connectivity is unavailable. The delegate can use this opportunity to update the user interface; for example, by presenting an offline mode or a cellular-only mode. 委任先は、この機会を利用して、ユーザインターフェイスを更新できます;例えば、オフラインモードまたはセルラーのみのモードを提示することによって。

This method is called, at most, once per task, and only if connectivity is initially unavailable. It is never called for background sessions because waitsForConnectivity is ignored for those sessions. このメソッドは、最大で、タスクごとに一度だけ、そして接続性が最初に利用可能でない場合にのみ呼び出されます。それは決してバックグラウンドセッションに対して呼び出されません、なぜならwaitsForConnectivityがそのようなセッションに無視されるからです。

See Also 参照

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