urlSession(_:task:didCompleteWithError:)
Tells the delegate that the task finished transferring data.
Declaration
optional func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: (any Error)?)Parameters
- session:
The session containing the task that has finished transferring data.
- task:
The task that has finished transferring data.
- error:
If an error occurred, an error object indicating how the transfer failed, otherwise
NULL.
Mentioned in
Discussion
The only errors your delegate receives through the error parameter are client-side errors, such as being unable to resolve the hostname or connect to the host. To check for server-side errors, inspect the response property of the task parameter received by this callback.