<!--
{
  "availability" : [
    "iOS: 14.5.0 -",
    "iPadOS: 14.5.0 -",
    "macCatalyst: 14.5.0 -",
    "macOS: 11.3.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKDownloadDelegate/download(_:didFailWithError:resumeData:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(pl)WKDownloadDelegate(im)download:didFailWithError:resumeData:"
  },
  "title" : "download(_:didFailWithError:resumeData:)"
}
-->

# download(_:didFailWithError:resumeData:)

Tells the delegate that the download failed, with error information and data you can use to restart the download.

```
optional func download(_ download: WKDownload, didFailWithError error: any Error, resumeData: Data?)
```

## Parameters

`download`

The download that failed.

`error`

An error describing what caused the download to fail.

`resumeData`

A data object you use to restart the download.

## Discussion

To restart a failed download, call [`resumeDownload(fromResumeData:completionHandler:)`](/documentation/WebKit/WKWebView/resumeDownload(fromResumeData:completionHandler:)) with `resumeData`.

---

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)