Instance Method

discoverUserIdentity(withEmailAddress:completionHandler:)

Returns the user record ID associated in the user’s contacts with the email address.

Declaration

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

Parameters

email

The email address used to locate the user

completionHandler

The block to execute with the results. Your block must be capable of executing on any thread of the app. This block returns no value and takes the following parameters:

userInfo

The user (CKUserIdentity object) associated with the email address, or nil if an identity could not be located.

error

An error object if a problem occurs or nil if the CKUserIdentity is retrieved successfully.

Discussion

Use this method to retrieve the ID of a user that is known to the current user. The user you are searching for must meet the following criteria:

  • The user must be in the current user’s address book.

  • The user must have run the app.

  • The user must have granted the userDiscoverability permission for this container.

This method searches for the user asynchronously and with a low priority. If you want the task to execute with a higher priority, create a CKDiscoverUserInfosOperation object and configure the desired priority.

See Also

Discovering User Records

func discoverAllContactUserInfos(completionHandler: ([CKDiscoveredUserInfo]?, Error?) -> Void)

Retrieves information about all discoverable users that are known to the current user.

Deprecated
func discoverAllIdentities(completionHandler: ([CKUserIdentity]?, Error?) -> Void)

Fetches all user records that match an entry in the user’s address book.

func discoverUserIdentity(withPhoneNumber: String, completionHandler: (CKUserIdentity?, Error?) -> Void)

Returns the user record ID associated in the user’s contacts with the phone number.

func discoverUserIdentity(withUserRecordID: CKRecord.ID, completionHandler: (CKUserIdentity?, Error?) -> Void)

Retrieves information about a single user based on the ID of the corresponding user record.

func discoverUserInfo(withEmailAddress: String, completionHandler: (CKDiscoveredUserInfo?, Error?) -> Void)

Retrieves information about a single user based on that user’s email address.

Deprecated
func discoverUserInfo(withUserRecordID: CKRecord.ID, completionHandler: (CKDiscoveredUserInfo?, Error?) -> Void)

Retrieves information about a single user based on the ID of the corresponding user record.

Deprecated
func fetchShareParticipant(withEmailAddress: String, completionHandler: (CKShare.Participant?, Error?) -> Void)

Retrieves information about a single share participant (a person who accepted a shared record) based on that participant’s email address.

func fetchShareParticipant(withPhoneNumber: String, completionHandler: (CKShare.Participant?, Error?) -> Void)

Retrieves information about a single share participant (a person who accepted a shared record) based on that participant’s phone number.

func fetchShareParticipant(withUserRecordID: CKRecord.ID, completionHandler: (CKShare.Participant?, Error?) -> Void)

Retrieves information about a single share participant based on the ID of the corresponding user record.

func fetchUserRecordID(completionHandler: (CKRecord.ID?, Error?) -> Void)

Returns the user record ID associated with the current user.