17.11 · Records, system fields and CKError handling
CloudKit sync code is mostly error handling: knowing which record state you hold and what each failure asks of you.
Mental model. A CKRecord is a dictionary plus server-owned system fields; a CKError names the next step.
Records
Fields, system fields, parents and zones.
- What is in a CKRecord, why archive its system fields, and what are the zone rules for references and parents?
A record is a typed key-value dictionary (allKeys() shows the fields, changedKeys() the ones not yet sent) plus system fields managed by the server: record id…
Errors
Partial failures, retries and conflicts.
- How should a sync layer react to CKError codes: partial failures, retry-after, conflicts and expired tokens?
Operations report failure as CKError; branch on code. A batch usually fails as .partialFailure (code 2), whose partialErrorsByItemID holds one CKError per…
More in System frameworks
- 17.1 · UserNotifications, APNs and how a push actually gets delivered
- 17.2 · Core Location and MapKit
- 17.3 · Contacts, Calendar, Photos, HealthKit and Core Motion
- 17.4 · CloudKit, StoreKit 2 and PassKit
- 17.5 · AuthenticationServices and passkeys, Spotlight, Handoff and user activities
- 17.6 · Live Activities, WeatherKit, App Clips and CarPlay
- 17.7 · A checklist for learning any Apple framework
- 17.8 · APNs tokens, payload budgets and notification triggers
- 17.9 · Cleaning location fixes, choosing geofences, and map geometry
- 17.10 · Contacts, EventKit, HealthKit units and sensor availability
- 17.12 · Passkey assertions, Apple ID tokens and Live Activity payloads