<!--
{
  "availability" : [
    "macCatalyst: 14.0.0 -",
    "macOS: 10.14.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "iTunesLibrary",
  "identifier" : "/documentation/iTunesLibrary/ITLibrary/init(apiVersion:options:)-9eorg",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "iTunes Library"
    ],
    "preciseIdentifier" : "c:objc(cs)ITLibrary(im)initWithAPIVersion:options:error:"
  },
  "title" : "init(apiVersion:options:)"
}
-->

# init(apiVersion:options:)

Initializes an instance of `ITLibrary` that can retrieve media entities.

```
init(apiVersion requestedAPIVersion: String, options: ITLibInitOptions) throws
```

## Parameters

`requestedAPIVersion`

The version of the iTunesLibrary API that the app is requesting. Provide `"1.0"` if unknown.

`options`

Options that change the initialization behavior. See [`ITLibInitOptions`](/documentation/iTunesLibrary/ITLibInitOptions).

## Return Value

An [`ITLibrary`](/documentation/iTunesLibrary/ITLibrary) instance that can retrieve media entities, or `nil` if the method fails.

## Discussion

Unless you specify the [`ITLibInitOptions.lazyLoadData`](/documentation/iTunesLibrary/ITLibInitOptions/lazyLoadData) option, the system reads and parses the default iTunes database for the current user during initialization of the [`ITLibrary`](/documentation/iTunesLibrary/ITLibrary) class. All media entities cache in memory until deallocation of the object occurs.

---

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)