An object that retrieves metadata for a URL.


@interface LPMetadataProvider : NSObject


Use LPMetadataProvider to fetch metadata for a URL, including its title, icon, and image or video links. All properties on the resulting LPLinkMetadata instance are optional.

Fetch Link Metadata from a URL

For each metadata request, create an instance of LPMetadataProvider and call startFetchingMetadataForURL:completionHandler:.

In the completion handler, check the error. If your user doesn’t have a network connection, the fetch can fail. If the server doesn’t respond or is too slow, the fetch can time out. Alternatively, the app may cancel the request, or an unknown error may occur.

Otherwise, use the metadata however you want, for example, to populate the title for a table view cell.

let metadataProvider = LPMetadataProvider()
let url = URL(string: "")!

metadataProvider.startFetchingMetadata(for: url) { metadata, error in
    if error != nil {
        // The fetch failed; handle the error.

    // Make use of fetched metadata.

For more information about handling link presentation errors, see LPError.


Fetching Metadata

- startFetchingMetadataForURL:completionHandler:

Fetches metadata for the given URL.

- cancel

Cancels a metadata request.


A Boolean value indicating whether to download subresources specified by the metadata.


The time interval after which the request automatically fails if it hasn’t already completed.


Inherits From

See Also

Link Metadata


An object that contains metadata about a URL.