Contents

fetchShareMetadatas(for:completionHandler:)

Fetches share metadatas for the specified share URLs.

Declaration

@preconcurrency func fetchShareMetadatas(for urls: [URL], completionHandler: @escaping  @Sendable (Result<[URL : Result<CKShare.Metadata, any Error>], any Error>) -> Void)

Parameters

  • urls:

    The share URLs that CloudKit uses to locate the metadatas.

  • completionHandler:

    The handler to execute with the fetch results.

Discussion

The closure doesn’t return a value and takes the following parameters:

  • A dictionary of fetched share metadatas. The dictionary uses the URLs you specify in urls as its keys. The value of each key is a Result that contains either the corresponding fetched share metadata, or an error that describes why CloudKit can’t fetch that share metadata.

This method searches for share metadatas asynchronously and with a low priority. If you want the task to execute with a higher priority, create an instance of CKFetchShareMetadataOperation and configure it to use the necessary priority.