CloudKit - initializeCloudKitSchema error

Hi,

I've previously used a local core data database successfully with my app and now I wanted to use NSPersistentCloudKitContainer to store the data in CloudKit. However when I do container.initializeCloudKitSchema(options: []) I receive an error which I'm not able to comprehend:

CoreData: error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _requestAbortedNotInitialized:](2112): <NSCloudKitMirroringDelegate: 0x6000037b00e0> - Never successfully initialized and cannot execute request '<NSCloudKitMirroringImportRequest: 0x600002dfeee0> 17E8940B-00D6-4D01-AA78-6A04EBEBC957' due to error: <CKError 0x600000032040: "Partial Failure" (2/1011); "Failed to modify some records"; uuid = CED7F4CE-5B7C-4AF9-84F7-AC65C5E431BA; container ID = "iCloud.com.my.identifier"; partial errors: {
	CD_FAKE_Item_A225280B-016E-4B2E-B9F2-DEAE9F83A856:(com.apple.coredata.cloudkit.zone:__defaultOwner__) = <CKError 0x6000000edcb0: "Invalid Arguments" (12/2006); server message = "Cannot create new type CD_Item in production schema"; op = 1D0AF7734BF5657B; uuid = CED7F4CE-5B7C-4AF9-84F7-AC65C5E431BA>
	... 9 "Batch Request Failed" CKError's omited ...
}>

I also get this error in the console: "Atomic failure"

<CKRecordID: 0x60000007dec0; recordName=CD_FAKE_Item_9C9B2AF5-9BB0-4EE1-95F5-1C060C67C0F7, zoneID=com.apple.coredata.cloudkit.zone:__defaultOwner__>" = "<CKError 0x600000e4ea00: \"Batch Request Failed\" (22/2024); server message = \"Atomic failure\"; op = 94FDC06EC8764FC3; uuid = 9BFB7F0A-BA16-4CDC-80FA-F897EF294419; container ID = \"iCloud.com.my.identifier\">

I've tried to reset Reset Environment in the CloudKit dashboard to no avail.

Answered by peterwarbo in 752147022

I figured out what was causing this error. I hade previously set com.apple.developer.icloud-container-environment to Production. When I deleted this it worked fine.

Accepted Answer

I figured out what was causing this error. I hade previously set com.apple.developer.icloud-container-environment to Production. When I deleted this it worked fine.

CloudKit - initializeCloudKitSchema error
 
 
Q