<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "LinkPresentation",
  "identifier" : "/documentation/LinkPresentation/LPMetadataProvider/startFetchingMetadata(for:completionHandler:)-54z5i",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Link Presentation"
    ],
    "preciseIdentifier" : "c:objc(cs)LPMetadataProvider(im)startFetchingMetadataForURL:completionHandler:"
  },
  "title" : "startFetchingMetadata(for:completionHandler:)"
}
-->

# startFetchingMetadata(for:completionHandler:)

Fetches metadata for the given URL.

```
func startFetchingMetadata(for URL: URL, completionHandler: @escaping @Sendable (LPLinkMetadata?, (any Error)?) -> Void)
```

## Discussion

Call this method once per [`LPMetadataProvider`](/documentation/LinkPresentation/LPMetadataProvider) instance. If you attempt to
fetch metadata multiple times on a single [`LPMetadataProvider`](/documentation/LinkPresentation/LPMetadataProvider) instance,
it throws an error.

The completion handler executes on a background queue. Dispatch any
necessary UI updates back to the main queue. When the completion handler
returns, it deletes any file URLs returned in the resulting
[`LPLinkMetadata`](/documentation/LinkPresentation/LPLinkMetadata).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)