<!--
{
  "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/URLSessionConfiguration/sharedContainerIdentifier",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSURLSessionConfiguration(py)sharedContainerIdentifier"
  },
  "title" : "sharedContainerIdentifier"
}
-->

# sharedContainerIdentifier

The identifier for the shared container into which files in background URL sessions should be downloaded.

```
var sharedContainerIdentifier: String? { get set }
```

## Discussion

To create a URL session for use by an app extension, set this property to a valid identifier for a container shared between the app extension and its containing app.

> Important:
> If you try to create a URL session from your app extension but fail to set this property to a valid value, the URL session is invalidated upon creation.

For information about app extensions, see [App Extension Programming Guide](https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/index.html#//apple_ref/doc/uid/TP40014214).

## See Also

[`NSURLErrorBackgroundSessionRequiresSharedContainer`](/documentation/Foundation/NSURLErrorBackgroundSessionRequiresSharedContainer-swift.var)

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

[`NSURLErrorBackgroundSessionRequiresSharedContainer`](/documentation/Foundation/NSURLErrorBackgroundSessionRequiresSharedContainer-c.enum.case)

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



---

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)