Initialize Your CloudKit Schema During Development
let container = NSPersistentCloudKitContainer(name: "Earthquakes")
// Only initialize the schema when building the app with the
// Debug build configuration.
#if DEBUG
do {
// Use the container to initialize the development schema.
try container.initializeCloudKitSchema(options: [])
} catch {
// Handle any errors.
}
#endif
All variable length attribute types—String, Binary Data, and Transformable—generate an additional field with a key in the form CD_[attribute.name]_ckAsset. If a field’s value grows too large to store within the record size limit of 1MB, Core Data automatically converts the value to an external asset. Core Data transitions between the original field and its asset counterpart transparently during serialization. When inspecting a CloudKit record directly, check the length of the original field’s value; if it is zero, look in the asset field.
For example, an entity named Post with String content and title attributes would generate the following fully materialized record, with pairs of fields for CD_content and CD_content_ckAsset, and for CD_title and CD_title_ckAsset.
Setting Up Core Data with CloudKit
Creating a Core Data Model for CloudKit
Initialize Your CloudKit Schema During Development
Reading CloudKit Records for Core Data
iCloud Drive
https://developer.apple.com/documentation/coredata/sharing_core_data_objects_between_icloud_users
Debugging
Debugging Core Data
Optimize your use of Core Data and CloudKit
Read more