简体   繁体   English

如何通过CloudKit检索登录用户的AppleID?

[英]How to retrieve AppleID of logged in user via CloudKit?

I figured out how to retrieve first / lastName of a logged in user. 我想通了如何检索第一 /登录的用户的lastName的 Is there a way to get the AppleID too?! 有没有办法也可以获取AppleID?

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

    defaultContainer.discoverUserInfoWithUserRecordID(recordID, {userInfo, error in

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

        })

You cannot retrieve the current user's email address - you're going to have to ask for it outside of CloudKit. 您无法检索当前用户的电子邮件地址-您将不得不在CloudKit之外要求它。 This is a privacy thing. 这是一件隐私事。 You're supposed to use the UserRecordId to uniquely identify users. 您应该使用UserRecordId来唯一标识用户。

You can , however, search for other users if you already know their email address with CKDiscoverUserInfosOperation . 可以 ,但是,搜索其他用户,如果你已经知道他们的电子邮件地址CKDiscoverUserInfosOperation

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM