使用iCloud Apple ID匿名登录应用程序 [英] Anonymously Log In to an App with iCloud Apple ID

查看:223
本文介绍了使用iCloud Apple ID匿名登录应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据此 CloudKit概述


CloudKit还允许您的用户使用他们的iCloud Apple ID匿名登录您的应用,而无需共享他们的个人信息。

CloudKit also enables your users to anonymously sign in to your apps with their iCloud Apple IDs without sharing their personal information.

我在他们的文档中找不到关于此功能的任何其他内容。我已经有了一个带有我自己后端的应用程序,因此我不需要任何CloudKit提供的后端即服务功能,但我想利用用户登录iCloud帐户,与我们目前使用Facebook和Twitter的方式大致相同。

I can't find anything else in their documentation about this capability. I already have an app with my own backend, so I wouldn't need any of the back-end-as-a-service features that CloudKit offers, but I would like to take advantage of logging a user in with their iCloud account, much the same way we currently do with Facebook and Twitter.

使用CloudKit是否可行,或者您是否还必须利用其BAAS功能才能利用登录功能?

Is that possible with CloudKit, or do you also have to leverage their BAAS features in order to take advantage of login?

推荐答案

根据他们在WWDC讨论的内容,您可以使用 fetchUserRecordIDWithCompletionHandler执行此操作: CKContainer 上的方法。返回与当前用户对应的 CKRecordID 。此ID在各个设备上都是稳定的,但每个应用都有所不同 - 因此,如果同一个人在多个设备上使用您的应用,您的应用会在任何地方获得相同的结果,但其他应用会从您的应用获得不同的结果。

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.

一旦你有 CKRecordID ,你可以使用<$ c $查找有限的其他用户数据(他们的名字和电子邮件) C> fetchRecordWithID:completionHandler:。此请求将触发用户的权限警报,因此只有在允许的情况下才能获得该请求。

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.

这不要求您在CloudKit中使用其他任何内容。它确实要求用户实际在设备上配置了iCloud帐户。

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.

这篇关于使用iCloud Apple ID匿名登录应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆