According to this CloudKit overview:
CloudKit also enables your users to anonymously sign in to your apps with their iCloud Apple IDs without sharing thei
From what they discussed at WWDC, you'd do this using the fetchUserRecordIDWithCompletionHandler:
method on CKContainer
. That returns a CKRecordID
that corresponds to the current user. This ID will be stable across devices but different for each app-- so if the same person uses your app on multiple devices, your app will get the same result everywhere, but other apps would get different results from yours.
Once you have the CKRecordID
you can look up limited other user data (their name and email, I think) using fetchRecordWithID:completionHandler:
. This request will trigger a permission alert to the user, so you only get it if they allow it.
This doesn't require you to use anything else in CloudKit. It does require that the user actually have an iCloud account configured on the device.
The permission alert will only pop if you call -[CKContainer requestApplicationPermission:CKApplicationPermissionUserDiscoverability...]
.
If the user grants permission (CKApplicationPermissionStatusGranted
) then you can get the user's first and last name by running a CKDiscoverUserInfosOperation
.
Requesting discoverability means that you can see the user's first and last name, and that any other user of the container can find their user record ID via an email address or look up their first and last name via a user record ID.