One Logo Pool Ball
MusicKit · IOS API REFERENCE

MusicAuthorization

struct · iOS 15.0+ · SDK 27.1

struct MusicAuthorization

A type that allows you to request the user’s informed consent for your app to access their music data.

Members (2)

get · iOS 15.0+

currentStatus

TypeScript
static get currentStatus(): MusicAuthorization_Status
Swift declaration
static var currentStatus: MusicAuthorization.Status { get }

The authorization status the user sets for accessing MusicKit.

static · iOS 15.0+

request

TypeScript
static request(): Promise<MusicAuthorization_Status>
Swift declaration
static func request() async -> MusicAuthorization.Status

Asks the user for permission for the current app to access MusicKit. Before using any other MusicKit API in your app, make sure the user grants your app access to their Apple Music data, You can do this either by comparing ``MusicAuthorization/currentStatus`` to ``MusicAuthorization/Status/authorized``, or by simply calling ``MusicAuthorization/request()`` regardless of the current authorization status value. Calling ``MusicAuthorization/request()`` results in presenting a standard user consent dialog to the user when necessary. Requesting authorization to use MusicKit requires the inclusion of a short description of the app’s reason for using MusicKit. You need to add this purpose string to the app’s `Info.plist` file using the [NSAppleMusicUsageDescription](<doc://com.apple.documentation/documentation/bundleresources/information-property-list/nsapplemusicusagedescription>) key.

Skipped declarations

No declarations were skipped in this snapshot.

All MusicKit types →