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.

See Also

Handling Delayed and Waiting Tasks