Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i get the current user information from iCloud using Cloudkit , swift

My question is how do i get the currently logged in user information from iCloud using cloudkit. i want to add more fields to this user defaults section and retrieve those data when i want it. I have tried making new schema to save user data.

like image 999
Dr.Ax Avatar asked Oct 22 '25 19:10

Dr.Ax


1 Answers

It is possible to add extra fields to the User recordType in CloudKit, but it's not adviced. The User recordType is a special recordType with lots of limitations. It's better to create a new record type where you save additional user settings. Then you could set a CKReference to the actual user recordId.

For getting the active user recordID use the CKcontainer function fetchUserRecordIDWithCompletionHandler. If you want to get the first and last name (you can't get more information) then use the function discoverUserInfoWithUserRecordID

like image 109
Edwin Vermeer Avatar answered Oct 24 '25 10:10

Edwin Vermeer