---
title: LPMetadataProvider
framework: linkpresentation
role: symbol
role_heading: Class
path: linkpresentation/lpmetadataprovider
---

# LPMetadataProvider

An object that retrieves metadata for a URL.

## Declaration

```swift
class LPMetadataProvider
```

## Overview

Overview 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. note: To enable macOS clients to fetch metadata for remote URLs, add the com.apple.security.network.client entitlement. Fetch link metadata from a URL For each metadata request, create an instance of LPMetadataProvider and call startFetchingMetadata(for: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: "https://www.apple.com/ipad")!

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

// Make use of fetched metadata. } For more information about handling errors, see LPError.

## Topics

### Fetching metadata

- [startFetchingMetadata(for:completionHandler:)](linkpresentation/lpmetadataprovider/startfetchingmetadata(for:completionhandler:)-54z5i.md)
- [cancel()](linkpresentation/lpmetadataprovider/cancel().md)
- [shouldFetchSubresources](linkpresentation/lpmetadataprovider/shouldfetchsubresources.md)
- [timeout](linkpresentation/lpmetadataprovider/timeout.md)

### Instance Methods

- [startFetchingMetadata(for:completionHandler:)](linkpresentation/lpmetadataprovider/startfetchingmetadata(for:completionhandler:)-9e6s8.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Link metadata

- [LPLinkMetadata](linkpresentation/lplinkmetadata.md)
