A URL load request that is independent of protocol or URL scheme.
- iOS 7.0+
- macOS 10.9+
- tvOS 9.0+
- watchOS 2.0+
- Xcode 8.0+
URLRequest encapsulates two essential properties of a load request: the URL to load and the policies used to load it. In addition, for HTTP and HTTPS requests,
URLRequest includes the HTTP method (
POST, and so on) and the HTTP headers.
URLRequest only represents information about the request. Use other classes, such as
URLSession, to send the request to a server. See Fetching Website Data into Memory and Uploading Data to a Website for an introduction to these techniques.
Certain header fields are reserved; see Reserved HTTP Headers.