Contents

Requesting Access to Apple Music Library

Prompt the customer to authorize access to Apple Music library.

Overview

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 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.

[Image]

See 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’s authorizationStatus() before attempting to access their Apple Music library.

If the authorization status is SKCloudServiceAuthorizationStatus.notDetermined, call SKCloudServiceController’s requestAuthorization(_:) to prompt the user for access.

The system remembers the user’s answer so that subsequent calls to requestAuthorization(_:) don’t prompt them again.

See Also

Getting authorization to access the Music library