如何通过CloudKit检索登录用户的AppleID? [英] How to retrieve AppleID of logged in user via CloudKit?

查看:142
本文介绍了如何通过CloudKit检索登录用户的AppleID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我弄清楚了如何检索已登录用户的 first / lastName

I figured out how to retrieve first / lastName of a logged in user. Is there a way to get the AppleID too?!

var defaultContainer = CKContainer.defaultContainer()
var publicDatabase = defaultContainer.publicCloudDatabase

    defaultContainer.discoverUserInfoWithUserRecordID(recordID, {userInfo, error in

        println("firstName: \(userInfo.firstName?) lastName: \(userInfo.lastName?)")

        })


推荐答案

您无法检索当前用户的电子邮件地址-您将不得不在CloudKit之外要求它。这是一件隐私的事情。您应该使用 UserRecordId 来唯一标识用户。

You cannot retrieve the current user's email address - you're going to have to ask for it outside of CloudKit. This is a privacy thing. You're supposed to use the UserRecordId to uniquely identify users.

可以 ,但是,如果您已经知道他们的电子邮件地址,请使用 CKDiscoverUserInfosOperation

You can, however, search for other users if you already know their email address with CKDiscoverUserInfosOperation.

这篇关于如何通过CloudKit检索登录用户的AppleID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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