A protocol that defines methods that URL session instances call on their delegates to handle task-level events.
SDKs
- iOS 7.0+
- macOS 10.9+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Foundation
Declaration
protocol URLSessionTaskDelegate
Overview
If you’re using download tasks, also implement the methods in the URLSession
protocol.
If you’re using data or upload tasks, also implement the methods in the URLSession
protocol.
Note
Your URLSession
object doesn’t need to have a delegate. If no delegate is assigned, a system-provided delegate is used, and you must provide a completion callback to obtain the data.