Core Data+CloudKit:No record on CloudKit Dashboard

Hi,everyone

I use CloudKit + CoreData to store data. It works normally during the test, but when I log in to CloudKit Dashboard, there is no record here, but there is a record of device access in the log.

In addition, the icloud account and development account I used in the test are not the same account. Will this have an impact?

Thank you.

Answered by AncientCoder in 705994022

CloudKit records from CoreData integration are stored in a special zone (com.apple.coredata.zone) not in _defaultZone, which the CloudKit dashboard shows by default. Also, the dashboard is set by default to view the public database. So, make sure you've selected the correct database (public/private) and zone in order to view records. The "out-of-the-box" implementation of CoreData / CloudKit sync does not, and will not, store any records in the Public database.

Also, CoreData record types (entities) and fields (attributes) in CloudKit have their CoreData model names preceded by CD_, e.g. a CoreData entity called Period with startTime and endTime attributes would appear in CloudKit's CoreData zone as CD_Period with CD_startTime and CD_endTime.

I'm not sure what you mean with the iCloud account vs Development account. I find that running an app in debug mode in Xcode and accessing the CloudKit console also from Xcode (in "Signing & Capabilities") ensures that I'm looking at the correct CloudKit database.

I hope this helps. Regards, Michaela

Accepted Answer

CloudKit records from CoreData integration are stored in a special zone (com.apple.coredata.zone) not in _defaultZone, which the CloudKit dashboard shows by default. Also, the dashboard is set by default to view the public database. So, make sure you've selected the correct database (public/private) and zone in order to view records. The "out-of-the-box" implementation of CoreData / CloudKit sync does not, and will not, store any records in the Public database.

Also, CoreData record types (entities) and fields (attributes) in CloudKit have their CoreData model names preceded by CD_, e.g. a CoreData entity called Period with startTime and endTime attributes would appear in CloudKit's CoreData zone as CD_Period with CD_startTime and CD_endTime.

I'm not sure what you mean with the iCloud account vs Development account. I find that running an app in debug mode in Xcode and accessing the CloudKit console also from Xcode (in "Signing & Capabilities") ensures that I'm looking at the correct CloudKit database.

I hope this helps. Regards, Michaela

Core Data+CloudKit:No record on CloudKit Dashboard
 
 
Q