Common CloudKit sync issues and solutions for TheCompanyApp.
Not Syncing Across Devices
Created company on iPhone, doesn't appear on iPad (same Apple ID).
Causes & Solutions
1. Not Signed In to iCloud
Copy Settings → [Your Name] → iCloud → Ensure signed in 2. iCloud Drive Disabled for App
Copy Settings → [Your Name] → iCloud → TheCompanyApp → Enable toggle 3. Network Issues
Check Wi-Fi or cellular connection
Try toggling Airplane Mode off/on
Wait 1-2 minutes for sync to complete
4. CloudKit Zone Not Created
Sign out of iCloud, sign back in
Reset sync: See "Reset CloudKit Data" below
5. Check Sync Events Add logging to detect sync failures:
Share Not Received
Owner sends share link, participant taps link but nothing happens.
1. Check URL Scheme
Share URL must start with https://www.icloud.com/share/
Ensure universal links enabled in Xcode
2. App Not Installed
Participant must have TheCompanyApp installed
Safari won't redirect to app otherwise
3. Wrong Apple ID
Participant must be signed in to iCloud
Cannot accept share without iCloud account
4. Share Already Accepted
Check if company already in "Shared With Me" section
Company might have synced but UI not refreshed
5. Manual Accept Try programmatic accept:
Duplicate Companies
Same company appears multiple times in list.
1. Accepted Share Multiple Times
Each acceptance creates new local record
CloudKit de-duplicates on server, local doesn't
2. Local and Shared Copies
Owner sees company in Private Store
After sharing, it appears in Shared Store duplicate? No - should only be in Private.
Participant sees only in Shared Store
Delete one copy:
Participant Can't Edit
Participant sees data but cannot modify.
1. Check CKShare Permission Owner must set "Can Edit":
2. Check AccessControl Query AccessControl entity:
3. Network Delay
Wait 30 seconds after accepting share
Permissions sync may be delayed
Changes Not Syncing to Owner
Participant creates order, owner doesn't see it.
1. Enlistment Missing Ensure new objects enlisted in share:
2. Owner Polling Shared Database Owner's device must poll both Private and Shared:
This is automatic with NSPersistentCloudKitContainer
Restart app to force refresh
3. Merge Policy Conflict Check if local changes being overwritten:
Error: "iCloud storage full" or CKErrorQuotaExceeded.
1. Public vs Private Database
TheCompanyApp uses Private/Shared (counts against user's iCloud quota)
Public Database has 10 PB free (not used here)
2. User's iCloud Storage Full
User must upgrade plan or delete files.
3. Large Attachments
Reduce image sizes (see ImageOptimizer.swift)
Delete old dispatch records
4. Developer Account Exceeded
App owner's CloudKit dashboard shows usage
Contact Apple if limits reached
CKErrorNetworkUnavailable
Solution : Check internet connection, wait and retry.
CKErrorZoneBusy
Solution : CloudKit throttling. Wait 30-60 seconds, retry.
CKErrorRequestRateLimited
Solution : Too many requests. Implement exponential backoff:
Reset CloudKit Data
Warning : Deletes all CloudKit data. Use only for testing.
Development Environment
Select TheCompanyApp container
Development → Reset Schema and Records
Delete app from device, reinstall
Production Environment
Cannot reset production data . Users must:
Delete all companies manually
Or delete app, reinstall (local data only)
Enable CloudKit Logging
macOS/iOS Console App :
Filter by com.apple.coredata.cloudkit
Look for CloudKit operation logs
Xcode Arguments :
Logs will appear in Xcode console during sync operations.
Related : Sync States , Conflict Resolution , Share Testing Checklist