Contents

contentItem(forIdentifier:completionHandler:)

Retrieves the content item associated with the provided identifier.

Declaration

optional func contentItem(forIdentifier identifier: String, completionHandler: @escaping  @Sendable (MPContentItem?, (any Error)?) -> Void)
optional func contentItem(forIdentifier identifier: String) async throws -> MPContentItem

Parameters

  • identifier:

    The String that identifies a content item.

  • completionHandler:

    A block that is called after the content item has been loaded.

    contentItem

    The content item associated with the identifier. If there is no content item, the value of this parameter is nil.

    error

    If an error occurred, this parameter holds the error object that explains the error. Otherwise, the value of this parameter is nil.

Discussion

Client apps should always call the completion handler after loading has finished.

See Also

Retrieving a media item