How to retrieve AppleID of logged in user via CloudKit?

北城以北 提交于 2019-12-12 20:27:17

问题


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?)")

        })

回答1:


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.

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



来源:https://stackoverflow.com/questions/24789592/how-to-retrieve-appleid-of-logged-in-user-via-cloudkit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!