问题
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