Returns the user record ID associated with the current user.
- iOS 8.0+
- macOS 10.10+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 3.0+
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:
The ID of the user record for the current user, or
nilif the current device is not configured with an iCloud account.
An error object if a problem occurs, or
nilif the record ID is retrieved successfully.
At startup time, fetching the user record ID may take longer while CloudKit makes the initial iCloud account request. After the initial fetch, accessing the user record ID should take less time. If no iCloud account is associated with the device, or if access to the user’s iCloud account is restricted, this method returns an error of type