<!--
{
  "availability" : [
    "iOS: 10.0.0 - 17.0.0",
    "iPadOS: 10.0.0 - 17.0.0",
    "macCatalyst: 13.1.0 - 17.0.0",
    "macOS: 10.12.0 - 14.0.0",
    "tvOS: 10.0.0 - 17.0.0",
    "visionOS: 1.0.0 - 1.0.0",
    "watchOS: 3.0.0 - 10.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "CloudKit",
  "identifier" : "/documentation/CloudKit/CKContainer/discoverUserIdentity(withEmailAddress:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "CloudKit"
    ],
    "preciseIdentifier" : "c:objc(cs)CKContainer(im)discoverUserIdentityWithEmailAddress:completionHandler:"
  },
  "title" : "discoverUserIdentity(withEmailAddress:completionHandler:)"
}
-->

# discoverUserIdentity(withEmailAddress:completionHandler:)

Fetches the user identity for the specified email address.

```
func discoverUserIdentity(withEmailAddress email: String, completionHandler: @escaping @Sendable (CKUserIdentity?, (any Error)?) -> Void)
```

## Parameters

`email`

The user’s email address.

`completionHandler`

The handler to execute with the fetch results.

## Discussion

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

- The user identity for the email address, or `nil` if CloudKit can’t find an identity.
- An error if a problem occurs, or `nil` if CloudKit successfully fetches a user identity.

Use this method to retrieve the identity of a user who the current user knows. The user 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 the user 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)