Which way to get currently logged in user in iOS?

Under what conditions should we use CKContainer.fetchUserRecordID() and then fetch the CKRecord object, and under what conditions should we use CKFetchRecordsOperation.fetchCurrentUserRecordOperation().

Replies

CKContainer.fetchUserRecordID() executes the operation and fetches the record.

CKFetchRecordsOperation.fetchCurrentUserRecordOperation() is a class function used to generate a CKOperation, which when executed would fetch you the record. But has an additional requirement: You must associate at least one progress handler with the operation object (docs)

You probably want to go with the first one.