<!--
{
  "documentType" : "article",
  "framework" : "StoreKit",
  "identifier" : "/documentation/StoreKit/requesting-access-to-apple-music-library",
  "metadataVersion" : "0.1.0",
  "role" : "article",
  "title" : "Requesting Access to Apple Music Library"
}
-->

# Requesting Access to Apple Music Library

Prompt the customer to authorize access to Apple Music library.

## Discussion

Your app must obtain permission from the customer before accessing Apple Music Library.

### Provide a Purpose String in Info.plist

Provide a purpose string or usage description that describes how your app intends to use the user’s iCloud Music library or Apple Music catalog. Add the <doc://com.apple.documentation/documentation/BundleResources/Information-Property-List/NSAppleMusicUsageDescription> key to your app’s Info.plist. Set its value to a string that explains why your app needs access to Apple Music library. The system displays the string to the user when prompting them for authorization.

![Privacy - Media Library Usage Description](images/com.apple.storekit/media-3580813@2x.png)

> Important:
> This key is required for apps that access the user’s music library. Apps crash when the key is absent.

See <doc://com.apple.documentation/documentation/UIKit/requesting-access-to-protected-resources> for more details.

### Request Authorization

The user determines whether apps can play items from the Apple Music catalog or add tracks to their iCloud Music library. They can grant or deny access when your app requests authorization. Because the user can change your app’s authorization status in Settings > Privacy > Media and Apple Music, be sure to call [`SKCloudServiceController`](/documentation/StoreKit/SKCloudServiceController)’s [`authorizationStatus()`](/documentation/StoreKit/SKCloudServiceController/authorizationStatus()) before attempting to access their Apple Music library.

```swift
guard SKCloudServiceController.authorizationStatus() == .notDetermined else { return }
```

If the authorization status i`s` [`SKCloudServiceAuthorizationStatus.notDetermined`](/documentation/StoreKit/SKCloudServiceAuthorizationStatus/notDetermined), call [`SKCloudServiceController`](/documentation/StoreKit/SKCloudServiceController)’s [`requestAuthorization(_:)`](/documentation/StoreKit/SKCloudServiceController/requestAuthorization(_:)) to prompt the user for access.

```swift
SKCloudServiceController.requestAuthorization {(status: SKCloudServiceAuthorizationStatus) in
    switch status {
    case .denied, .restricted: disableAppleMusicBasedFeatures()
    case .authorized: enableAppleMusicBasedFeatures()
    default: break
    }
}
```

The system remembers the user’s answer so that subsequent calls to [`requestAuthorization(_:)`](/documentation/StoreKit/SKCloudServiceController/requestAuthorization(_:)) don’t prompt them again.

---

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)