<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSURLErrorBackgroundSessionRequiresSharedContainer-swift.var",
  "metadataVersion" : "0.1.0",
  "role" : "Global Variable",
  "symbol" : {
    "kind" : "Global Variable",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:So50NSURLErrorBackgroundSessionRequiresSharedContainerSivp"
  },
  "title" : "NSURLErrorBackgroundSessionRequiresSharedContainer"
}
-->

# NSURLErrorBackgroundSessionRequiresSharedContainer

The shared container identifier of the URL session configuration is needed but hasn’t been set.

```
var NSURLErrorBackgroundSessionRequiresSharedContainer: Int { get }
```

## Discussion

To use a [`URLSession`](/documentation/Foundation/URLSession) to perform background uploading or downloading in an app extension, you coordinate with the host app using a shared container. The app extension must set the [`sharedContainerIdentifier`](/documentation/Foundation/URLSessionConfiguration/sharedContainerIdentifier) of the URL session’s configuration to the shared container’s identifier. See [Performing Uploads and Downloads](https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html#//apple_ref/doc/uid/TP40014214-CH21-SW2) in [App Extension Essentials](https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/index.html#//apple_ref/doc/uid/TP40014214-CH4) for more information.

---

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)