<!--
{
  "availability" : [
    "iOS: 27.3.0 -",
    "iPadOS: 27.3.0 -",
    "macCatalyst: 27.3.0 -",
    "macOS: 27.3.0 -",
    "tvOS: 27.3.0 -",
    "watchOS: 27.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVURLAsset/setUpConnection(for:options:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVURLAsset(cm)setUpConnectionForURL:options:completionHandler:"
  },
  "title" : "setUpConnection(for:options:completionHandler:)"
}
-->

# setUpConnection(for:options:completionHandler:)

Prewarms a network connection to the specified host without creating an asset.

```
class func setUpConnection(for url: URL, options: [String : Any]? = nil, completionHandler: (@Sendable ((any Error)?) -> Void)? = nil)
```

```
class func setUpConnection(for url: URL, options: [String : Any]? = nil) async throws
```

## Parameters

`url`

URL containing the scheme, hostname and port for which to establish the connection. This should mirror the eventual asset URL. The actual HTTP request will not be sent (i.e. URL path is ignored).

`options`

The same AVURLAsset creation options dictionary that will be used when creating the eventual AVURLAsset instance.

`completionHandler`

An optional completion handler called when the prewarming attempt completes. The handler receives an NSError if the prewarming failed, or nil on success. The completion handler will always be invoked asynchronously.

## Discussion

The connection will be established using the same URLSession configuration that would be used for AVURLAsset instances created with the specified options.
This allows the connection to be reused when an actual asset is later created. This is a best-effort API.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)