fetchUserRecordID(completionHandler:)
Fetches the user record ID of the current user.
Declaration
func fetchUserRecordID(completionHandler: @escaping @Sendable (CKRecord.ID?, (any Error)?) -> Void)func userRecordID() async throws -> CKRecord.IDParameters
- completionHandler:
The handler to execute with the fetch results.
Discussion
The closure doesn’t return a value and takes the following parameters:
The user record ID, or
nilif the user disables iCloud or the device doesn’t have an iCloud account.An error if a problem occurs, or
nilif CloudKit successfully retrieves the user record ID.
CloudKit returns a CKError.Code.notAuthenticated error when any of the following conditions are met:
The device has an iCloud account but the user disables iCloud.
The device has an iCloud account with restricted access.
The device doesn’t have an iCloud account.
See Also
Discovering User Records
discoverAllIdentities(completionHandler:)discoverUserIdentity(withEmailAddress:completionHandler:)discoverUserIdentity(withPhoneNumber:completionHandler:)discoverUserIdentity(withUserRecordID:completionHandler:)fetchShareParticipant(withEmailAddress:completionHandler:)fetchShareParticipant(withPhoneNumber:completionHandler:)fetchShareParticipant(withUserRecordID:completionHandler:)CKCurrentUserDefaultNameCKOwnerDefaultName