Performs a synchronous load of the specified 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.
Out parameter for the URL response returned by the server.
Out parameter used if an error occurs while processing the request. May be
The downloaded data for the URL request. Returns
nil if a connection could not be created or if the download fails.
A synchronous load is built on top of the asynchronous loading code made available by the class. The calling thread is blocked while the asynchronous loading system performs the URL load on a thread spawned specifically for this load request. No special threading or run loop configuration is necessary in the calling thread in order to perform a synchronous load.
If authentication is required in order to download the request, the required credentials must be specified as part of the URL. If authentication fails, or credentials are missing, the connection will attempt to continue without credentials.