Returns an initialized URL connection and begins to load the data for the URL request.
- iOS 2.0–9.0Deprecated
- macOS 10.3–10.11Deprecated
- Mac Catalyst 13.0–13.0Deprecated
- tvOS 9.0–9.0Deprecated
The URL request to load. The
requestobject is deep-copied as part of the initialization process. Changes made to
requestafter this method returns do not affect the request that is used for the loading process.
The delegate object for the connection. The connection calls methods on this delegate as the load progresses. Delegate methods are called on the same thread that called this method. By default, for the connection to work correctly, the calling thread’s run loop must be operating in the default run loop mode. See
schedule(in:to change the run loop and mode.
The URL connection for the URL request. Returns
nil if a connection can't be initialized.
This is equivalent to calling
init(request: and passing
During the download the connection maintains a strong reference to the
delegate. It releases that strong reference when the connection finishes loading, fails, or is canceled.