discoverUserIdentity(withUserRecordID:completionHandler:)
Fetches the user identity for the specified user record ID.
Declaration
func discoverUserIdentity(withUserRecordID userRecordID: CKRecord.ID, completionHandler: @escaping @Sendable (CKUserIdentity?, (any Error)?) -> Void)func userIdentity(forUserRecordID userRecordID: CKRecord.ID) async throws -> CKUserIdentity?Parameters
- userRecordID:
The user record’s ID.
- 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 user record ID, or
nilif CloudKit can’t find an identity.An error if a problem occurs, or
nilif CloudKit successfully fetches a user identity.
Use this method to retrieve the identity of a user who you already have a user record ID for. The user you’re searching for must meet the following criteria:
The user has run the app.
The user grants the 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 and configure it to use the necessary priority.
See Also
Discovering User Records
discoverAllIdentities(completionHandler:)discoverUserIdentity(withEmailAddress:completionHandler:)discoverUserIdentity(withPhoneNumber:completionHandler:)fetchShareParticipant(withEmailAddress:completionHandler:)fetchShareParticipant(withPhoneNumber:completionHandler:)fetchShareParticipant(withUserRecordID:completionHandler:)fetchUserRecordID(completionHandler:)CKCurrentUserDefaultNameCKOwnerDefaultName