---
title: backgroundSessionWasDisconnected
framework: foundation
role: symbol
role_heading: Type Property
path: foundation/urlerror/backgroundsessionwasdisconnected
---

# backgroundSessionWasDisconnected

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

## Declaration

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

## Discussion

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.

## See Also

### Error codes

- [appTransportSecurityRequiresSecureConnection](foundation/urlerror/apptransportsecurityrequiressecureconnection.md)
- [backgroundSessionInUseByAnotherProcess](foundation/urlerror/backgroundsessioninusebyanotherprocess.md)
- [backgroundSessionRequiresSharedContainer](foundation/urlerror/backgroundsessionrequiressharedcontainer.md)
- [badServerResponse](foundation/urlerror/badserverresponse.md)
- [badURL](foundation/urlerror/badurl.md)
- [callIsActive](foundation/urlerror/callisactive.md)
- [cancelled](foundation/urlerror/cancelled.md)
- [cannotCloseFile](foundation/urlerror/cannotclosefile.md)
- [cannotConnectToHost](foundation/urlerror/cannotconnecttohost.md)
- [cannotCreateFile](foundation/urlerror/cannotcreatefile.md)
- [cannotDecodeContentData](foundation/urlerror/cannotdecodecontentdata.md)
- [cannotDecodeRawData](foundation/urlerror/cannotdecoderawdata.md)
- [cannotFindHost](foundation/urlerror/cannotfindhost.md)
- [cannotLoadFromNetwork](foundation/urlerror/cannotloadfromnetwork.md)
- [cannotMoveFile](foundation/urlerror/cannotmovefile.md)
