Search code examples
iosicloudcloudkit

iOS: What does CloudKit login look like to the user?


In this excellent post / answer: Anonymously Log In to an App with iCloud Apple ID there is discussion about how to retrieve an app-specific ID for a user (fetchUserRecordIDWithCompletionHandler: method on CKContainer).

Further, there is discussion about how to request additional details from the user (fetchRecordWithID:completionHandler:).

My question (I don't have a Apple Developer account) is: what do these two steps look like (if applicable) to the end-user? Specifically,

  • Does the initial request for the simple RecordID require user permission?
    • If so, what does the the prompt look like?
  • What does the second request (to get email address or name data, for example) look like?

Screenshots or examples of apps currently using this framework are greatly appreciated.


Solution

  • The call to fetchRecordWithID: doesn't actually prompt the user. The record fetched will be empty, but you can store any values you'd like on it.

    If you make the current user discoverable in your container then:

    • Anyone with this user record ID can look up the first and last name of the user
    • Anyone can find this user's record if they search for one of the email addresses associated with the account

    Becoming discoverable exposes information about the user to other users of that container, so CloudKit will prompt the user with an alert to make sure they want to become discoverable.

    You can request discoverability permissions by calling -[CKContainer requestApplicationPermission:CKApplicationPermissionUserDiscoverability...]