Contents

CKUserIdentity

The identity of a user.

Declaration

class CKUserIdentity

Overview

A user identity provides identifiable data about an iCloud user, including their name, user record ID, and an email address or phone number. CloudKit retrieves this information from the user’s iCloud account. A user must give their consent to be discoverable before CloudKit can provide this data to your app. For more information, see requestApplicationPermission(_:completionHandler:).

You don’t create instances of this class. Instead, CloudKit provides them in certain contexts. A share’s owner has a user identity, as does each of its participants. When creating participants, CloudKit tries to find iCloud accounts it can use to populate their identities. If CloudKit doesn’t find an account, it sets the identity’s hasiCloudAccount property to false.

You can also discover the identities of your app’s users by executing one of the user discovery operations: CKDiscoverAllUserIdentitiesOperation and CKDiscoverUserIdentitiesOperation. Identities that CloudKit discovers using CKDiscoverAllUserIdentitiesOperation correspond to entries in the device’s Contacts database. These identities contain the identifiers of their Contact records, which you can use to fetch those records from the Contacts database. For more information, see contactIdentifiers.

Topics

Accessing iCloud Information

Accessing User Information

Initializers

See Also

User discovery