Anonymously Log In to an App with iCloud Apple ID

前端 未结 2 1562
谎友^
谎友^ 2021-02-04 17:41

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

相关标签:
2条回答
  • 2021-02-04 18:14

    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.

    0 讨论(0)
  • 2021-02-04 18:31

    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.

    0 讨论(0)
提交回复
热议问题