<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 8.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URLError/backgroundSessionWasDisconnected",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation8URLErrorV32backgroundSessionWasDisconnectedAC4CodeVvpZ"
  },
  "title" : "backgroundSessionWasDisconnected"
}
-->

# backgroundSessionWasDisconnected

The app is suspended or exits while a background data task is processing.

```
static var backgroundSessionWasDisconnected: URLError.Code { get }
```

## Discussion

If your app has created a background data task and the app is then suspended, the task will be invalidated with this error code. To prevent this, when you receive the response, convert the data task to a download 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)