---
title: "init(keySystem:storageDirectoryAt:)"
framework: avfoundation
role: symbol
role_heading: Initializer
path: "avfoundation/avcontentkeysession/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.

## Declaration

```swift
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

Return Value Returns a new AVContentKeySession instance.

## Discussion

Discussion The AVContentKeySession instance returned is capable of managing a collection of content decryption keys that correspond to the input key system. An invalidArgumentException is raised when the value of keySystem is unsupported.

## See Also

### Creating a session

- [init(keySystem:)](avfoundation/avcontentkeysession/init(keysystem:).md)
