---
title: "fetchShareMetadata(with:completionHandler:)"
framework: cloudkit
role: symbol
role_heading: Instance Method
path: "cloudkit/ckcontainer/fetchsharemetadata(with:completionhandler:)"
---

# fetchShareMetadata(with:completionHandler:)

Fetches the share metadata for the specified share URL.

## Declaration

```swift
func fetchShareMetadata(with url: URL, completionHandler: @escaping @Sendable (CKShare.Metadata?, (any Error)?) -> Void)
```

## Parameters

- `url`: The share URL that CloudKit uses to locate the metadata.
- `completionHandler`: The handler to execute with the fetch results.

## Discussion

Discussion The closure doesn’t return a value and takes the following parameters: The share metadata, or nil if CloudKit can’t find the metadata. An error if a problem occurs, or nil if CloudKit successfully retrieves the metadata.

## See Also

### Accessing Container Metadata

- [accept(_:completionHandler:)](cloudkit/ckcontainer/accept(_:completionhandler:)-949ea.md)
- [CKAccountChanged](foundation/nsnotification/name-swift.struct/ckaccountchanged.md)
