<!--
{
  "availability" : [
    "iOS: 15.0.0 - 17.0.0",
    "iPadOS: 15.0.0 - 17.0.0",
    "macCatalyst: 15.0.0 - 17.0.0",
    "macOS: 12.0.0 - 14.0.0",
    "tvOS: 15.0.0 - 17.0.0",
    "visionOS: -",
    "watchOS: 8.0.0 - 10.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "CloudKit",
  "identifier" : "/documentation/CloudKit/CKContainer/discoverUserIdentities(forEmailAddresses:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "CloudKit"
    ],
    "preciseIdentifier" : "s:So11CKContainerC8CloudKitE22discoverUserIdentities17forEmailAddresses17completionHandlerySaySSG_ys6ResultOySDySSSo14CKUserIdentityCGs5Error_pGctF"
  },
  "title" : "discoverUserIdentities(forEmailAddresses:completionHandler:)"
}
-->

# discoverUserIdentities(forEmailAddresses:completionHandler:)

Fetches the user identities for the specified email addresses.

```
@preconcurrency func discoverUserIdentities(forEmailAddresses emails: [String], completionHandler: @escaping @Sendable (Result<[String : CKUserIdentity], any Error>) -> Void)
```

## Parameters

`emails`

The users’ email addresses.

`completionHandler`

The handler to execute with the fetch results.

## Discussion

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

- A <doc://com.apple.documentation/documentation/Swift/Result> that contains either a dictionary of user identities, or an error that describes why CloudKit can’t discover the email addresses.
  
  In the successful case, the dictionary uses the email addresses you specify in `emails` as its keys. Only successfully discovered user identities are present in this dictionary.

Use this method to retrieve the identities of users who the current user knows. The users you’re searching for must meet the following criteria:

- The user has run the app.
- The user grants the [`userDiscoverability`](/documentation/CloudKit/CKContainer/ApplicationPermissions/userDiscoverability) permission for the container.

This method searches for users asynchronously and with a low priority. If you want the task to execute the request with a higher priority, create an instance of [`CKDiscoverUserIdentitiesOperation`](/documentation/CloudKit/CKDiscoverUserIdentitiesOperation) and configure it to use the necessary priority.

---

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)