<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URLSessionDataDelegate/urlSession(_:dataTask:didBecome:)-60op5",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(pl)NSURLSessionDataDelegate(im)URLSession:dataTask:didBecomeDownloadTask:"
  },
  "title" : "urlSession(_:dataTask:didBecome:)"
}
-->

# urlSession(_:dataTask:didBecome:)

Tells the delegate that the data task was changed to a download task.

```
optional func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didBecome downloadTask: URLSessionDownloadTask)
```

## Parameters

`session`

The session containing the task that was replaced by a download task.

`dataTask`

The data task that was replaced by a download task.

`downloadTask`

The new download task that replaced the data task.

## Discussion

When your [`urlSession(_:dataTask:didReceive:completionHandler:)`](/documentation/Foundation/URLSessionDataDelegate/urlSession(_:dataTask:didReceive:completionHandler:)) delegate method uses the [`URLSession.ResponseDisposition.becomeDownload`](/documentation/Foundation/URLSession/ResponseDisposition/becomeDownload) disposition to convert the request to use a download, the session calls this delegate method to provide you with the new download task. After this call, the session delegate receives no further delegate method calls related to the original data task.

---

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)