CloudKit key and encryption errors on iOS 15 beta 1 on Simulator?

I am having trouble with my existing CloudKit app on iOS 15 beta simulator. Tried with Xcode 13 beta 1 on both Big Sur and Monterey.

When I try to set up CloudKit record zones, I get the error:

<CKError 0x600000ad34e0: "Partial Failure" (2/1011); "Failed to modify some record zones"; partial errors: {
	Zone1:__defaultOwner__ = <CKError 0x600000aab990: "Internal Error" (1/5000); "Failed to sync user keys">
	Zone2:__defaultOwner__ = <CKError 0x600000aac180: "Internal Error" (1/5000); "Failed to sync user keys">
}>

And when I try to retrieve some records:

<CKError 0x600000aa6670: "Partial Failure" (2/1011); "Failed to fetch some query results"; partial errors: {

	17E15463-28D9-4A8F-9C00-13864C0B1922:(Zone1:__defaultOwner__) = <CKError 0x600000a74120: "Internal Error" (1/5001); "Record <CKRecordID: 0x7fea11997820; recordName=17E15463-28D9-4A8F-9C00-13864C0B1922, zoneID=Zone1:__defaultOwner__> has items that require encryption but no zone protection data was found: <CKError 0x7fea105c6b40: "Internal Error" (5000/com.apple.protectedcloudstorage:97); "Failed to sync user keys">">

	4CADA078-7040-4633-9321-C1FF6C5BF80C:(Zone1:__defaultOwner__) = <CKError 0x600000a6c570: "Internal Error" (1/5001); "Record <CKRecordID: 0x7fea1198d250; recordName=4CADA078-7040-4633-9321-C1FF6C5BF80C, zoneID=Zone1:__defaultOwner__> has items that require encryption but no zone protection data was found: <CKError 0x7fea105c6b40: "Internal Error" (5000/com.apple.protectedcloudstorage:97); "Failed to sync user keys">">

	E1558266-C19A-4A46-BC1A-B11303DA87FC:(Zone1:__defaultOwner__) = <CKError 0x600000a60210: "Internal Error" (1/5001); "Record <CKRecordID: 0x7fea132dfb80; recordName=E1558266-C19A-4A46-BC1A-B11303DA87FC, zoneID=Zone1:__defaultOwner__> has items that require encryption but no zone protection data was found: <CKError 0x7fea13263e60: "Internal Error" (5000/com.apple.protectedcloudstorage:97); "Failed to sync user keys">">

}>

<CKError 0x600000af8d50: "Partial Failure" (2/1011); "Failed to fetch some query results"; partial errors: {

	BE1508B0-20C1-483A-B536-FFA1949E758A:(Zone1:_9b181defada871111c80080a15254790) = <CKError 0x600000aec7b0: "Internal Error" (1/5001); "Record <CKRecordID: 0x7fea1198cf00; recordName=BE1508B0-20C1-483A-B536-FFA1949E758A, zoneID=Zone1:_9b181defada871111c80080a15254790> has items that require encryption but no share protection data was found: <CKError 0x7fea105980b0: "Internal Error" (5004/5004); "Couldn't create share PCS data for share <CKRecordID: 0x7fea119910d0; recordName=Share-7347C086-8BA5-47C6-96AD-1DD12B1AAC8D, zoneID=Zone1:_9b181defada871111c80080a15254790>">">

	F1D604B6-A4BC-4F2E-A23E-5B50A2D7C82D:(Zone1:_9b181defada871111c80080a15254790) = <CKError 0x600000a740f0: "Internal Error" (1/5001); "Record <CKRecordID: 0x7fea11985170; recordName=F1D604B6-A4BC-4F2E-A23E-5B50A2D7C82D, zoneID=Zone1:_9b181defada871111c80080a15254790> has items that require encryption but no share protection data was found: <CKError 0x7fea107bfb10: "Internal Error" (5004/5004); "Couldn't create share PCS data for share <CKRecordID: 0x7fea10416370; recordName=Share-C990C533-D709-4B7D-B916-418336386366, zoneID=Zone1:_9b181defada871111c80080a15254790>">">

}>

I wonder if anyone else has experienced the same? Or if I can do something on my end to fix it?

I’ve filed FB9144546 about this.

I'm having the same issue with an established app with Xcode 12 & iOS14 using NSPersistentCloudKitContainer. When I try to run the exact code with iOS15 & Xcode 13 (Developer Beta 1 for both) I see the "Failed to sync user keys" error.

I suspect this is an early beta bug so hopefully it will disappear in subsequent betas.

Similar to you both, I also see this error with NSPersistentCloudKitContainer in an existing iOS app which worked fine on iOS 14.5 and Xcode 12. I also notice I am no longer able to use the public database in conjunction with NSPersistentCloudKitContainer, and am forced to use the private database. Perhaps early beta bugs, as @nitramluap said.

Hopefully we'll find out next week when beta 2 drops! 🤞🏼😬

Just in case you don't want to wait for the next beta, the error seems to occur in Simulator but not when run from an actual device with iOS15 beta

For information, in addition to Xcode Beta, this also happens to me with Xcode 12.5 and iPad simulators with iOS 14.5 (but it works in iPhone simulators!).

I really hope it gets resolved soon. Anybody knows if this has been reported to Apple?

I'm still having these problems on Beta 2. Anyone else?

This is fixed in Xcode 13 beta 3. I had to "Erase all Content and Settings..." which is in the Simulator menu under "Device" -> "Erase all Content and Settings...". You'll have to sign back in to iCloud in settings after that is done.

Related thread.

Hi, do you remember what caused the issue? I currently have similar issue when testing in simulator and wonder if this is temporary CloudKit issue

I linked my project with Core Data to CloudKit about a month ago and no problems. Now, I just hooked up a new project and am experiencing problems with the CoreData Records showing up in CloudKit Dashboard too.

I'm seeing this with Xcode 14 final release, although it worked fine all throughout Beta period. I've reset the simulator (as mentioned above) but still occurs. Anyone found a reliable solution? FB11539971

I've been fighting this since last month. It first showed up in Xcode 14. If I ran my apps in Xcode 13, CloudKit worked in the simulator. Then at some point, I had to wipe some of the simulators. Once I did that, I started getting these errors in Xcode 13 as well so now my only option is to run on device.

This keeps happening to me with Xcode 14 and iOS 16 simulator.

The one extra insight I have is that it seems to be iCloud account specific. I use two iCloud accounts for testing. This happens with one but not the other. So whoever gets this might try with another iCloud account.

CloudKit key and encryption errors on iOS 15 beta 1 on Simulator?
 
 
Q