<!--
{
  "availability" : [
    "iOS: 10.3.0 -",
    "iPadOS: 10.3.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.4 -",
    "tvOS: 10.2.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVContentKeySession/init(keySystem:storageDirectoryAt:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVContentKeySession(cm)contentKeySessionWithKeySystem:storageDirectoryAtURL:"
  },
  "title" : "init(keySystem:storageDirectoryAt:)"
}
-->

# init(keySystem:storageDirectoryAt:)

Creates a content key session to manage a collection of content decryption keys; points to a directory that stores abnormal session termination reports.

```
convenience init(keySystem: AVContentKeySystem, storageDirectoryAt storageURL: URL)
```

## Parameters

`keySystem`

A valid key system used to retrieve keys.

`storageURL`

A URL that points to a writable directory. The session uses the directory to facilitate expired session reports after an abnormal session termination.

## Return Value

Returns a new AVContentKeySession instance.

## Discussion

The `AVContentKeySession` instance returned is capable of managing a collection of content decryption keys that correspond to the input key system. An <doc://com.apple.documentation/documentation/Foundation/NSExceptionName/invalidArgumentException> is raised when the value of `keySystem` is unsupported.

---

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)