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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With